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'