minauthator/Dockerfile

38 lines
1.2 KiB
Text
Raw Normal View History

2024-12-03 22:58:20 +00:00
FROM rust:1.83-alpine3.20 AS builder
WORKDIR /usr/src/minauthator
COPY . .
RUN apk add musl-dev
RUN cargo install --bin minauthator-admin --locked --path lib/admin_cli
RUN cargo install --bin minauthator-server --locked --path lib/http_server
FROM alpine:3.20 AS base
RUN apk add sqlite
COPY --from=builder /usr/local/cargo/bin/minauthator-server /usr/local/bin/minauthator-server
COPY --from=builder /usr/local/cargo/bin/minauthator-admin /usr/local/bin/minauthator-admin
RUN mkdir -p \
/usr/local/src/minauthator/migrations \
/usr/local/lib/minauthator/assets \
/var/lib/minauthator \
/etc/minauthator
COPY --from=builder /usr/src/minauthator/migrations/all.sql /usr/local/src/minauthator/migrations
COPY --from=builder /usr/src/minauthator/init_db.sh /usr/local/bin/minauthator_init_db.sh
COPY --from=builder /usr/src/minauthator/assets /usr/local/lib/minauthator/assets
RUN addgroup -g 1000 app && \
adduser -S -u 1000 -G app -s /bin/sh app && \
chown -R app:app /var/lib/minauthator && \
chmod -R u=rwx,g=rwx,o= /var/lib/minauthator
USER app:app
ENV RUST_LOG=info
ENV RUST_BACKTRACE=1
ENV APP_JWT_SECRET="DummyAppSecret20241029"
CMD ["minauthator-server", "--listen-host", "0.0.0.0", "--listen-port", "8080"]