Skip to content

Commit

Permalink
tweak build-image.yml: simplify build
Browse files Browse the repository at this point in the history
  • Loading branch information
imikushin committed Jan 6, 2025
1 parent 174eb17 commit c270424
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
.DS_Store
/.fleet
/.github
/.idea
/.run
/elf
/target
/tmp
Dockerfile
11 changes: 3 additions & 8 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Create and publish a Docker image

on:
push:
branches: ['release']
branches: ['release', 'test']
tags: ['v*']

# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
Expand All @@ -20,10 +20,6 @@ jobs:
packages: write
#
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# Uses the `docker/login-action` action to log in to the Container registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
Expand All @@ -46,10 +42,9 @@ jobs:
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/target
.DS_Store
/.idea
/elf/
/tmp/

/.run
/elf
/target
/tmp
8 changes: 3 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
FROM rust:alpine AS base
RUN apk add --no-cache musl-dev openssl-dev pkgconfig openssl-libs-static
RUN apk add --no-cache musl-dev openssl-dev openssl-libs-static pkgconfig
WORKDIR /app

FROM base AS builder
WORKDIR /app
COPY . .
RUN --mount=type=cache,target=/app/target \
--mount=type=cache,from=base,source=/usr/local/rustup,target=/usr/local/rustup \
cargo install --locked --path .
RUN cargo install --locked --path . --bin charms

FROM alpine AS runtime
COPY --from=builder /usr/local/cargo/bin/charms /usr/local/bin
Expand Down

0 comments on commit c270424

Please sign in to comment.