Changes: - Updated Rust from 1.75 to 1.83 in both Dockerfiles - Fixed CMD syntax: changed single quotes to double quotes (JSON format) Before: CMD ['cargo-watch', '-x', 'run'] After: CMD [cargo-watch, -x, run] This fixes the cargo-watch compilation error that required edition2024. Rust 1.83 supports all current crate features and editions.
18 lines
745 B
Docker
18 lines
745 B
Docker
FROM rust:1.83-alpine AS builder
|
|
WORKDIR /app
|
|
RUN apk add --no-cache musl-dev pkgconf openssl-dev
|
|
COPY Cargo.toml ./
|
|
RUN mkdir src && echo 'fn main() {}' > src/main.rs
|
|
RUN cargo build --release && rm -rf src
|
|
COPY src ./src
|
|
RUN touch src/main.rs && cargo build --release
|
|
|
|
FROM alpine:3.18
|
|
WORKDIR /app
|
|
RUN apk add --no-cache ca-certificates openssl wget
|
|
COPY --from=builder /app/target/release/normogen-backend /app/normogen-backend
|
|
RUN addgroup -g 1000 normogen && adduser -D -u 1000 -G normogen normogen && chown -R normogen:normogen /app
|
|
USER normogen
|
|
EXPOSE 8000
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 CMD wget --no-verbose --tries=1 --spider http://localhost:8000/health || exit 1
|
|
CMD ["./normogen-backend"]
|