Skip to content

Commit

Permalink
Enable Docker build caching
Browse files Browse the repository at this point in the history
  • Loading branch information
garyttierney committed Oct 12, 2024
1 parent 5049398 commit f28b016
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
FROM docker.io/library/rust:1.81-bookworm as builder
FROM docker.io/library/rust:1.81-bookworm AS builder

ARG TARGET="x86_64-unknown-linux-gnu"
ARG TARGET_CPU="native"

RUN apt-get update -y && apt-get install -y linux-headers-generic git libc6-dev
RUN rustup install stable

WORKDIR /build
COPY . /build

RUN RUSTFLAGS="-C target-feature=+crt-static -C target-cpu=${TARGET_CPU}" cargo build --target ${TARGET} --bin laya-server --release
RUN ls /build/target/release
RUN --mount-type=cache,target=/var/cache/apt \
apt-get update -y && apt-get install -y linux-headers-generic git libc6-dev
RUN --mount-type=cache,target=/usr/local/cargo/registry \
--mount-type=cache,target=/work/target \
rustup install stable && RUSTFLAGS="-C target-feature=+crt-static -C target-cpu=${TARGET_CPU}" cargo build --target ${TARGET} --bin laya-server --release

FROM scratch
ARG TARGET
Expand Down

0 comments on commit f28b016

Please sign in to comment.