From 8e24bbd88ae3a23f15d74720962a5b626e840f03 Mon Sep 17 00:00:00 2001 From: 409 <409dev@protonmail.com> Date: Sat, 12 Jul 2025 00:54:22 +0200 Subject: [PATCH] initial docker setup --- .dockerignore | 13 +++++++++++++ Dockerfile | 29 +++++++++++++++++++++++++++++ compose.yaml | 14 ++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 compose.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..a5f35c0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,13 @@ +.gitignore + +frontend/dist +frontend/.nuxt +frontend/.output +frontend/README.md +frontend/.prettierrc +frontend/.prettierignore +frontend/.gitignore +frontend/node_modules + +backend/target +backend/.gitignore diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..ff44906 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM oven/bun:debian AS frontend-dependency-installer +WORKDIR /usr/src/warren + +COPY frontend/package.json frontend/bun.lock ./ +RUN bun install --frozen-lockfile --ignore-scripts + + +FROM node:bookworm AS frontend-builder +WORKDIR /usr/src/warren + +COPY --from=frontend-dependency-installer /usr/src/warren/ . +COPY frontend/ ./ +RUN npm run generate + + +FROM rust:bookworm AS backend-builder +WORKDIR /usr/src/warren + +COPY backend/ . +RUN cargo build --release + + +FROM debian:bookworm +WORKDIR /var/lib/warren + +COPY --from=backend-builder /usr/src/warren/target/release/warren /usr/bin/warren +COPY --from=frontend-builder /usr/src/warren/dist ./frontend + +ENTRYPOINT ["warren"] diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 0000000..356e62e --- /dev/null +++ b/compose.yaml @@ -0,0 +1,14 @@ +services: + warren: + image: 'warren:latest' + container_name: 'warren' + build: '.' + postgres: + image: 'postgres:17' + container_name: 'warren-db' + volumes: + - './postgres-data:/var/lib/postgresql/data' + environment: + - 'POSTGRES_PASSWORD=pg' + ports: + - '5432:5432/tcp'