Skip to content

Commit

Permalink
build: setup multiplatform build
Browse files Browse the repository at this point in the history
  • Loading branch information
Veirt committed Aug 1, 2024
1 parent 1e0a79c commit 7c64571
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
targets: linux/amd64,linux/arm64
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
Expand Down
14 changes: 5 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
FROM rust:1.80 AS build

WORKDIR /usr/src
RUN apt-get update -y && \
apt-get install -y --no-install-recommends musl-tools && \
rustup target add x86_64-unknown-linux-musl
FROM --platform=$BUILDPLATFORM rust:1.80-alpine AS build

RUN apk add musl-dev --no-cache

WORKDIR /usr/src
RUN USER=root cargo new --bin vesta
WORKDIR /usr/src/vesta
COPY Cargo.toml Cargo.lock ./
COPY src ./src
RUN cargo install --target x86_64-unknown-linux-musl --path .

RUN cargo build --release

FROM scratch

WORKDIR /app
COPY ./static static
COPY --from=build /usr/src/vesta/target/x86_64-unknown-linux-musl/release/vesta .
COPY --from=build /usr/src/vesta/target/release/vesta /app/vesta

CMD ["/app/vesta"]

0 comments on commit 7c64571

Please sign in to comment.