Skip to content

Commit

Permalink
revert docker image change
Browse files Browse the repository at this point in the history
Signed-off-by: clux <[email protected]>
  • Loading branch information
clux committed Aug 25, 2023
1 parent b45661f commit 160cf5f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,18 @@ jobs:
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=pr
- name: Docker login on main origin
- name: Docker login
uses: docker/login-action@v2
#if: github.event_name != 'pull_request'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker buildx and push with GHA cache
- name: Docker build and push with cache
uses: docker/build-push-action@v4
with:
context: .
# official experimental: https://docs.docker.com/build/ci/github-actions/cache/#github-cache
#cache-from: type=gha
#cache-to: type=gha,mode=max
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache
#push: ${{ github.ref == 'refs/heads/main' }}
Expand Down
24 changes: 9 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
FROM rust:1.72-alpine as builder
RUN apk add --no-cache musl-dev
FROM clux/muslrust:stable AS builder
COPY Cargo.* .
COPY version.rs version.rs
RUN --mount=type=cache,target=/volume/target \
--mount=type=cache,target=/root/.cargo/registry \
cargo build --release --bin version && \
mv /volume/target/x86_64-unknown-linux-musl/release/version .

# Cache downloaded + built dependencies
COPY Cargo.toml Cargo.lock /
RUN echo 'fn main() {}' > /version.rs && \
cargo build --release && \
rm -f /version.rs

# Build our code
COPY version.rs /
RUN cargo build --release

# Runtime
FROM cgr.dev/chainguard/static
COPY --from=builder --chown=nonroot:nonroot /volume/version /app/
EXPOSE 8080
COPY --from=builder --chown=nonroot:nonroot /target/release/version /
ENTRYPOINT ["/version"]
ENTRYPOINT ["/app/version"]
2 changes: 1 addition & 1 deletion deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ spec:
containers:
- name: version
image: ghcr.io/kube-rs/version-rs:1.16.1
imagePullPolicy: Always
imagePullPolicy: IfNotPresent
resources:
limits:
cpu: 100m
Expand Down
15 changes: 11 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

VERSION := `git rev-parse HEAD`

[private]
default:
@just --list --unsorted
Expand All @@ -12,4 +9,14 @@ fmt:
cargo +nightly fmt

build:
docker build -t clux/version:{{VERSION}} .
docker build -t ghcr.io/kube-rs/version-rs:local .

[private]
release:
cargo release patch --execute

[private]
import:
k3d image import ghcr.io/kube-rs/version-rs:local --cluster main
sd "image: .*" "image: ghcr.io/kube-rs/version-rs:local" deployment.yaml
kubectl apply -f deployment.yaml
4 changes: 2 additions & 2 deletions release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
pre-release-replacements = [
{file="deployment.yaml", search="ghcr.io/kube-rs/version-rs:.*", replace="ghcr.io/kube-rs/version-rs:{{version}}"},
]
pre-release-commit-message = "release {{version}}"
push = false
pre-release-commit-message = "{{version}}"
push = push
tag = true
tag-name = "{{version}}"
sign-tag = true
Expand Down

0 comments on commit 160cf5f

Please sign in to comment.