ci: add docker support

This commit is contained in:
Matthieu Bessat 2024-08-02 16:39:21 +02:00
parent 3384228e61
commit 84a456003c
10 changed files with 189 additions and 112 deletions

24
Dockerfile Normal file
View file

@ -0,0 +1,24 @@
FROM rust:1.80-alpine3.20 as builder
WORKDIR /usr/src/autotasker
COPY . .
RUN apk add musl-dev
RUN cargo install --locked --path .
FROM alpine:3.20
RUN apk add sqlite
COPY --from=builder /usr/local/cargo/bin/autotasker /usr/local/bin/autotasker
RUN mkdir -p /usr/local/src/autotasker/migrations
RUN mkdir -p /usr/local/lib/autotasker/assets
RUN mkdir -p /var/lib/autotasker
RUN mkdir -p /etc/autotasker
COPY --from=builder /usr/src/autotasker/migrations/all.sql /usr/local/src/autotasker/migrations
COPY --from=builder /usr/src/autotasker/init_db.sh /usr/local/bin/autotasker_init_db.sh
COPY --from=builder /usr/src/autotasker/assets /usr/local/lib/autotasker/assets
USER 1000
ENV RUST_LOG=info
ENV RUST_BACKTRACE=1
CMD ["autotasker", "--listen-host", "127.0.0.1", "--listen-port", "8080"]