feat(docker): add docker support with Dockerfile and docker-compose.yaml

This commit is contained in:
Mariano Riefolo 2024-08-12 15:44:23 +02:00
parent fb2dd90181
commit 44f0b33fe5
2 changed files with 35 additions and 0 deletions

23
Dockerfile Normal file
View File

@ -0,0 +1,23 @@
FROM rust:1.80 AS builder
WORKDIR /code
COPY Cargo.toml Cargo.lock ./
RUN mkdir src && echo "fn main() {}" > src/main.rs
RUN cargo build --release
COPY src src
RUN cargo install --path .
FROM debian:bookworm-slim AS runtime
RUN apt-get update && \
apt-get install -y --no-install-recommends sqlite3 libsqlite3-dev && \
rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /usr/local/cargo/bin/script_hoster .
EXPOSE 3000
CMD ["./script_hoster"]

12
docker-compose.yaml Normal file
View File

@ -0,0 +1,12 @@
services:
web:
restart: unless-stopped
build: .
ports:
- "3000:3000"
volumes:
- ./.env:/app/.env:ro
- data:/app
volumes:
data: