build(docker): add Dockerfile
This commit is contained in:
parent
0243535469
commit
23f12904cc
7 changed files with 77 additions and 12 deletions
37
Dockerfile
Normal file
37
Dockerfile
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
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"]
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue