Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# syntax=docker/dockerfile:1

FROM rust:1.80-bullseye AS builder
WORKDIR /app

# Cache dependencies
COPY backend/Cargo.toml backend/Cargo.lock ./
COPY backend/src ./src
COPY backend/migrations ./migrations
RUN cargo build --release

FROM debian:bullseye-slim AS runtime
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
COPY --from=builder /app/target/release/guild-backend /usr/local/bin/guild-backend
ENV RUST_LOG=info
EXPOSE 3001
CMD ["/usr/local/bin/guild-backend"]


3 changes: 3 additions & 0 deletions backend/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
web: guild-backend


22 changes: 22 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: "3.9"

services:
db:
image: postgres:16-alpine
container_name: guild-postgres
environment:
POSTGRES_DB: guild
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d guild"]
interval: 5s
timeout: 3s
retries: 10

volumes:
pgdata:
24 changes: 24 additions & 0 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# syntax=docker/dockerfile:1

FROM node:20-alpine AS deps
WORKDIR /app
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci

FROM node:20-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY frontend .
# Build SSR server (output: server) using Node adapter config
RUN npm run build

FROM node:20-alpine AS runtime
WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/package.json ./package.json
RUN npm pkg set scripts.start="node dist/server/entry.mjs" && npm pkg delete dev && npm pkg delete build || true
EXPOSE 4321
CMD ["node", "dist/server/entry.mjs"]


3 changes: 3 additions & 0 deletions frontend/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
web: node dist/server/entry.mjs


Loading