This commit is contained in:
parent
adb95de2a9
commit
ed7fff4983
@ -31,5 +31,5 @@ jobs:
|
|||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: git.kanopo.dev/rhythm/rhythm-backend:latest
|
tags: git.kanopo.dev/rhythm/rhythm-backend:latest
|
||||||
cache-from: type=local,src=/tmp/.buildx-cache
|
cache-from: type=gha
|
||||||
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|||||||
@ -1,7 +1,16 @@
|
|||||||
FROM rust:1.95.0-alpine3.22 AS builder
|
FROM rust:1.95.0-alpine3.22 AS builder
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
# Cache dependencies by building a dummy project first
|
||||||
|
COPY Cargo.toml Cargo.lock ./
|
||||||
|
RUN mkdir src && echo "fn main() {}" > src/main.rs
|
||||||
|
RUN cargo build --release
|
||||||
|
RUN rm -rf src
|
||||||
|
|
||||||
|
# Copy real source code and build
|
||||||
COPY . .
|
COPY . .
|
||||||
|
# Touch the main file to ensure cargo sees it as newer than the dummy build
|
||||||
|
RUN touch src/main.rs
|
||||||
RUN cargo build --release
|
RUN cargo build --release
|
||||||
|
|
||||||
# Small runtime image
|
# Small runtime image
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user