Skip to content

Commit d1ffa02

Browse files
Make sane dockerfile
1 parent 1ae9d53 commit d1ffa02

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

.github/workflows/build.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@ jobs:
1919

2020
build:
2121
needs: [check]
22-
runs-on: ubuntu-latest
22+
runs-on: ${{ matrix.platform.gha-image }}
2323
strategy:
2424
fail-fast: false
2525
matrix:
2626
platform:
2727
- docker: linux/amd64
28-
llvm: x86_64
28+
gha-image: ubuntu-24.04
29+
slug: x86_64
2930
- docker: linux/arm64
30-
llvm: aarch64
31+
gha-image: ubuntu-24.04-arm
32+
slug: aarch64
3133
steps:
3234
- name: Check out code
3335
uses: actions/checkout@v4
@@ -48,8 +50,6 @@ jobs:
4850
with:
4951
context: .
5052
platforms: ${{ matrix.platform.docker }}
51-
build-args: |
52-
LLVMTARGETARCH=${{ matrix.platform.llvm }}
5353
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
5454

5555
- name: Export digest
@@ -61,7 +61,7 @@ jobs:
6161
- name: Upload digest
6262
uses: actions/upload-artifact@v4
6363
with:
64-
name: digests-${{ matrix.platform.llvm }}
64+
name: digests-${{ matrix.platform.slug }}
6565
path: /tmp/digests/*
6666
if-no-files-found: error
6767
retention-days: 1

Dockerfile

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
ARG LLVMTARGETARCH
2-
FROM --platform=${BUILDPLATFORM} ghcr.io/randomairborne/cross-cargo:${LLVMTARGETARCH} AS builder
3-
ARG LLVMTARGETARCH
1+
FROM rust:alpine AS builder
42

53
WORKDIR /build
64

75
COPY . .
86

9-
RUN cargo build --release --target ${LLVMTARGETARCH}-unknown-linux-musl
7+
RUN cargo build --release
108

119
FROM scratch
12-
ARG LLVMTARGETARCH
1310

14-
COPY --from=builder /build/target/${LLVMTARGETARCH}-unknown-linux-musl/release/giveip /usr/bin/giveip
11+
COPY --from=builder /build/target/release/giveip /usr/bin/giveip
1512
EXPOSE 8080
1613

1714
ENTRYPOINT ["/usr/bin/giveip"]

0 commit comments

Comments
 (0)