mirror of
https://github.com/Xevion/banner.git
synced 2025-12-05 23:14:20 -06:00
fix: add build.rs and .git dir to Dockerfile COPY build step, add git dependency
This commit is contained in:
@@ -28,6 +28,7 @@ FROM rust:${RUST_VERSION}-bookworm AS builder
|
|||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
|
git \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /usr/src
|
WORKDIR /usr/src
|
||||||
@@ -37,12 +38,18 @@ WORKDIR /usr/src/banner
|
|||||||
# Copy dependency files for better layer caching
|
# Copy dependency files for better layer caching
|
||||||
COPY ./Cargo.toml ./Cargo.lock* ./
|
COPY ./Cargo.toml ./Cargo.lock* ./
|
||||||
|
|
||||||
|
# Copy .git directory for build.rs to access Git information
|
||||||
|
COPY ./.git ./.git
|
||||||
|
|
||||||
|
# Copy build.rs early so it can run during the first build
|
||||||
|
COPY ./build.rs ./
|
||||||
|
|
||||||
# Build empty app with downloaded dependencies to produce a stable image layer for next build
|
# Build empty app with downloaded dependencies to produce a stable image layer for next build
|
||||||
RUN cargo build --release
|
RUN cargo build --release
|
||||||
|
|
||||||
# Copy source code
|
# Copy source code
|
||||||
RUN rm src/*.rs
|
RUN rm src/*.rs
|
||||||
COPY ./src ./src
|
COPY ./src ./src/
|
||||||
|
|
||||||
# Copy built frontend assets
|
# Copy built frontend assets
|
||||||
COPY --from=frontend-builder /app/dist ./web/dist
|
COPY --from=frontend-builder /app/dist ./web/dist
|
||||||
|
|||||||
Reference in New Issue
Block a user