From a9df43943e7d64681c0f01aa3df439c8b254451d Mon Sep 17 00:00:00 2001 From: SquidSpirit Date: Wed, 6 Aug 2025 21:44:06 +0800 Subject: [PATCH] BLOG-90 Fix backend docker build error (#123) ### Description - Using `alpine` for build environment. ### Package Changes _No response_ ### Screenshots _No response_ ### Reference Resolves #122. ### Checklist - [x] A milestone is set - [x] The related issuse has been linked to this branch Reviewed-on: https://git.squidspirit.com/squid/blog/pulls/123 Co-authored-by: SquidSpirit Co-committed-by: SquidSpirit --- backend/Dockerfile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 1ea55b8..780a9d3 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,15 +1,14 @@ -FROM rust:1-slim AS base -RUN apt update -qq && apt install -y -qq --no-install-recommends musl-tools -RUN rustup target add x86_64-unknown-linux-musl +FROM rust:1-alpine AS base +RUN apk add --no-cache build-base openssl-dev openssl-libs-static FROM base AS builder WORKDIR /app COPY . . -RUN cargo build --release --target x86_64-unknown-linux-musl +RUN cargo build --release FROM alpine:latest AS runner WORKDIR /app -COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/server . +COPY --from=builder /app/target/release/server . EXPOSE 8080 VOLUME ["/app/static"] ENV RUST_LOG=info