hesinde-sync/Containerfile

30 lines
622 B
Plaintext
Raw Permalink Normal View History

2024-07-10 13:36:25 +00:00
FROM docker.io/rust:1-alpine3.20 AS builder
2024-07-10 18:56:48 +00:00
RUN mkdir /db
2024-07-10 13:36:25 +00:00
RUN echo "hesinde:x:2222:2222:Linux User,,,:/:/app" > /passwd
RUN apk --no-cache add \
musl-dev
ENV CARGO_CARGO_NEW_VCS="none"
ENV CARGO_BUILD_RUSTFLAGS="-C target-feature=+crt-static"
WORKDIR /work
COPY . .
RUN cargo build --release --target=$(arch)-unknown-linux-musl
RUN cp "./target/$(arch)-unknown-linux-musl/release/hesinde-sync" /app
FROM scratch
COPY --from=builder /passwd /etc/passwd
COPY --from=builder /app /app
2024-07-10 18:56:48 +00:00
COPY --from=builder --chown=2222: /db /db
2024-07-10 13:36:25 +00:00
USER hesinde
2024-07-10 18:56:48 +00:00
ENTRYPOINT ["/app", "--address", "[::]:3000"]
2024-07-10 13:36:25 +00:00
EXPOSE 3000
2024-07-10 18:56:48 +00:00
VOLUME ["/db"]