little-hesinde/Containerfile

32 lines
713 B
Text
Raw Permalink Normal View History

2024-06-26 08:06:48 +02:00
FROM docker.io/rust:1-alpine3.20 AS builder
2024-05-10 17:09:07 +02:00
2024-06-26 22:35:03 +02:00
RUN mkdir /tmp/tmp
RUN echo "hesinde:x:2222:2222:Linux User,,,:/:/app" > /passwd
RUN apk --no-cache add \
musl-dev
2024-05-10 17:09:07 +02:00
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
2024-05-10 17:31:27 +02:00
RUN cp "./target/$(arch)-unknown-linux-musl/release/little-hesinde" /app
2024-05-10 17:09:07 +02:00
FROM scratch
2024-06-26 22:35:03 +02:00
COPY --from=builder /passwd /etc/passwd
2024-05-10 17:09:07 +02:00
COPY --from=builder /app /app
2024-06-26 22:35:03 +02:00
COPY --from=builder --chown=2222: /tmp/tmp /tmp
USER hesinde
CMD ["/app", "--listen-address", "[::]:3000", "--cache-path", "/tmp/cache", "--", "/library"]
2024-05-10 17:09:07 +02:00
2024-06-26 22:35:03 +02:00
ENV TMPDIR=/tmp
VOLUME ["/library", "/tmp"]
2024-05-10 17:09:07 +02:00
EXPOSE 3000