This commit is contained in:
syui 2024-10-28 02:14:39 +09:00
parent e4d62909c3
commit b74e58ff28
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,20 @@
FROM rust:1.78-alpine AS builder
RUN apk add libressl-dev musl-dev sqlite-dev
WORKDIR /usr/src/unravel
COPY . .
# TODO: Use cargo-chef to cache dependencies compilation independently of the binary
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/root/target \
cargo build --release --package drainpipe && \
# Move the release binary to a folder to be copied to the final image. It can't be copied directly from the target folder because it's in a cache mount
# See https://gist.github.com/noelbundick/6922d26667616e2ba5c3aff59f0824cd?permalink_comment_id=4379948#gistcomment-4379948
mv ./target/release /root
FROM alpine:3.14
COPY --from=builder /root/release/drainpipe /
ENV DATABASE_URL="/drainpipedata/drainpipe.db"
ENTRYPOINT ["/drainpipe"]

View File

@ -0,0 +1,9 @@
services:
drainpipe:
build:
dockerfile: ./packages-rs/drainpipe/Dockerfile
context: ../../
env_file:
- ./.env.local
volumes:
- ./drainpipedata:/drainpipedata