Compare commits

...

2 Commits

Author SHA1 Message Date
Tom Alexander
6f5e21f9f0
Update dockerfiles to take advantage of BuildKit.
Some checks failed
clippy Build clippy has failed
rust-test Build rust-test has failed
format Build format has failed
2024-10-20 23:38:57 -04:00
Tom Alexander
9ccfb65c77
Switch to version 0.0.1 2024-10-20 23:27:24 -04:00
7 changed files with 128 additions and 22 deletions

View File

@ -69,6 +69,31 @@ spec:
value: $(params.PULL_BASE_SHA)
- name: deleteExisting
value: "true"
- name: get-git-commit-time
taskSpec:
metadata: {}
stepTemplate:
image: alpine:3.20
computeResources:
requests:
cpu: 10m
memory: 600Mi
workingDir: "$(workspaces.repo.path)"
results:
- name: unix-time
description: The time of the git commit in unix timestamp format.
steps:
- image: alpine/git:v2.34.2
name: detect-tag-step
script: |
#!/usr/bin/env sh
set -euo pipefail
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
workspaces:
- name: repo
workspace: git-source
runAfter:
- fetch-repository
- name: build-image
taskRef:
resolver: git
@ -87,7 +112,7 @@ spec:
- name: DOCKERFILE
value: $(params.path-to-dockerfile)
- name: BUILDER_IMAGE
value: "gcr.io/kaniko-project/executor:v1.12.1"
value: "gcr.io/kaniko-project/executor:v1.23.2"
- name: EXTRA_ARGS
value:
- "--destination=$(params.image-name)" # Also write the :latest image
@ -189,4 +214,4 @@ spec:
- name: path-to-image-context
value: .
- name: path-to-dockerfile
value: docker/poudboot/Dockerfile
value: docker/poudboot/

View File

@ -69,6 +69,31 @@ spec:
value: $(params.PULL_BASE_SHA)
- name: deleteExisting
value: "true"
- name: get-git-commit-time
taskSpec:
metadata: {}
stepTemplate:
image: alpine:3.20
computeResources:
requests:
cpu: 10m
memory: 600Mi
workingDir: "$(workspaces.repo.path)"
results:
- name: unix-time
description: The time of the git commit in unix timestamp format.
steps:
- image: alpine/git:v2.34.2
name: detect-tag-step
script: |
#!/usr/bin/env sh
set -euo pipefail
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
workspaces:
- name: repo
workspace: git-source
runAfter:
- fetch-repository
- name: build-image
taskRef:
resolver: git
@ -87,7 +112,7 @@ spec:
- name: DOCKERFILE
value: $(params.path-to-dockerfile)
- name: BUILDER_IMAGE
value: "gcr.io/kaniko-project/executor:v1.12.1"
value: "gcr.io/kaniko-project/executor:v1.23.2"
- name: EXTRA_ARGS
value:
- "--target=$(params.target-name)"
@ -143,7 +168,7 @@ spec:
- build-image
params:
- name: docker-image
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
value: "$(tasks.build-image.results.IMAGE_URL[1])"
- name: commit-changes
taskRef:
resolver: git
@ -268,7 +293,7 @@ spec:
workspace: cargo-cache
params:
- name: docker-image
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
value: "$(tasks.build-image.results.IMAGE_URL[1])"
workspaces:
- name: git-source
- name: docker-credentials
@ -298,4 +323,4 @@ spec:
- name: path-to-image-context
value: docker/poudboot_development/
- name: path-to-dockerfile
value: docker/poudboot_development/Dockerfile
value: docker/poudboot_development/

View File

@ -69,6 +69,31 @@ spec:
value: $(params.PULL_BASE_SHA)
- name: deleteExisting
value: "true"
- name: get-git-commit-time
taskSpec:
metadata: {}
stepTemplate:
image: alpine:3.20
computeResources:
requests:
cpu: 10m
memory: 600Mi
workingDir: "$(workspaces.repo.path)"
results:
- name: unix-time
description: The time of the git commit in unix timestamp format.
steps:
- image: alpine/git:v2.34.2
name: detect-tag-step
script: |
#!/usr/bin/env sh
set -euo pipefail
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
workspaces:
- name: repo
workspace: git-source
runAfter:
- fetch-repository
- name: build-image
taskRef:
resolver: git
@ -87,7 +112,7 @@ spec:
- name: DOCKERFILE
value: $(params.path-to-dockerfile)
- name: BUILDER_IMAGE
value: "gcr.io/kaniko-project/executor:v1.12.1"
value: "gcr.io/kaniko-project/executor:v1.23.2"
- name: EXTRA_ARGS
value:
- "--target=$(params.target-name)"
@ -153,7 +178,7 @@ spec:
- build-image
params:
- name: docker-image
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
value: "$(tasks.build-image.results.IMAGE_URL[1])"
finally:
- name: report-success
when:
@ -247,7 +272,7 @@ spec:
workspace: cargo-cache
params:
- name: docker-image
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
value: "$(tasks.build-image.results.IMAGE_URL[1])"
workspaces:
- name: git-source
- name: docker-credentials
@ -277,4 +302,4 @@ spec:
- name: path-to-image-context
value: docker/poudboot_development/
- name: path-to-dockerfile
value: docker/poudboot_development/Dockerfile
value: docker/poudboot_development/

View File

@ -69,6 +69,31 @@ spec:
value: $(params.PULL_BASE_SHA)
- name: deleteExisting
value: "true"
- name: get-git-commit-time
taskSpec:
metadata: {}
stepTemplate:
image: alpine:3.20
computeResources:
requests:
cpu: 10m
memory: 600Mi
workingDir: "$(workspaces.repo.path)"
results:
- name: unix-time
description: The time of the git commit in unix timestamp format.
steps:
- image: alpine/git:v2.34.2
name: detect-tag-step
script: |
#!/usr/bin/env sh
set -euo pipefail
echo -n "$(git log -1 --pretty=%ct)" | tee $(results.unix-time.path)
workspaces:
- name: repo
workspace: git-source
runAfter:
- fetch-repository
- name: build-image
taskRef:
resolver: git
@ -87,7 +112,7 @@ spec:
- name: DOCKERFILE
value: $(params.path-to-dockerfile)
- name: BUILDER_IMAGE
value: "gcr.io/kaniko-project/executor:v1.12.1"
value: "gcr.io/kaniko-project/executor:v1.23.2"
- name: EXTRA_ARGS
value:
- "--target=$(params.target-name)"
@ -143,7 +168,7 @@ spec:
- build-image
params:
- name: docker-image
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
value: "$(tasks.build-image.results.IMAGE_URL[1])"
finally:
- name: report-success
when:
@ -237,7 +262,7 @@ spec:
workspace: cargo-cache
params:
- name: docker-image
value: "$(params.image-name):$(tasks.fetch-repository.results.commit)"
value: "$(tasks.build-image.results.IMAGE_URL[1])"
workspaces:
- name: git-source
- name: docker-credentials
@ -267,4 +292,4 @@ spec:
- name: path-to-image-context
value: docker/poudboot_development/
- name: path-to-dockerfile
value: docker/poudboot_development/Dockerfile
value: docker/poudboot_development/

2
Cargo.lock generated
View File

@ -94,7 +94,7 @@ checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
[[package]]
name = "poudboot"
version = "0.1.0"
version = "0.0.1"
dependencies = [
"rusqlite",
]

View File

@ -1,13 +1,16 @@
FROM rustlang/rust:nightly-alpine3.20 AS builder
# syntax=docker/dockerfile:1
ARG ALPINE_VERSION="3.20"
FROM rustlang/rust:nightly-alpine$ALPINE_VERSION AS builder
RUN apk add --no-cache musl-dev
RUN mkdir /root/poudboot
WORKDIR /root/poudboot
COPY . .
COPY --link . .
# TODO: Add static build, which currently errors due to proc_macro. RUSTFLAGS="-C target-feature=+crt-static"
RUN CARGO_TARGET_DIR=/target cargo build --profile release-lto
RUN --mount=type=tmpfs,target=/tmp --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked CARGO_TARGET_DIR=/target cargo build --profile release-lto
FROM alpine:3.20 AS runner
FROM alpine:$ALPINE_VERSION AS runner
COPY --from=builder /target/release-lto/poudboot /usr/bin/
COPY --link --from=builder /target/release-lto/poudboot /usr/bin/

View File

@ -1,6 +1,9 @@
FROM rustlang/rust:nightly-alpine3.20 AS builder
# syntax=docker/dockerfile:1
ARG ALPINE_VERSION="3.20"
FROM rustlang/rust:nightly-alpine$ALPINE_VERSION AS builder
RUN apk add --no-cache musl-dev
RUN cargo install --locked --no-default-features --features ci-autoclean cargo-cache
RUN --mount=type=tmpfs,target=/tmp --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked cargo install --locked --no-default-features --features ci-autoclean cargo-cache
RUN rustup component add rustfmt
RUN rustup component add clippy