diff --git a/backend/Dockerfile b/backend/Dockerfile new file mode 100644 index 00000000..8da7e785 --- /dev/null +++ b/backend/Dockerfile @@ -0,0 +1,21 @@ +# syntax=docker/dockerfile:1 + +# Use a smaller base image for production +FROM golang:1.22.2-alpine AS builder + +WORKDIR /app + +COPY go.mod go.sum ./ + +RUN go mod download + +COPY . . + +# Build the Go binary (optimized for production) +RUN mkdir -p /app/bin +RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /app/bin/sac + +# Install migrate for migrations +RUN go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest + +CMD ["/app/sac"] \ No newline at end of file diff --git a/deployment/docker-composes/webserver.yml b/deployment/docker-composes/webserver.yml index e69de29b..a5be1496 100644 --- a/deployment/docker-composes/webserver.yml +++ b/deployment/docker-composes/webserver.yml @@ -0,0 +1,27 @@ +services: + caddy: + image: caddy:latest + restart: unless-stopped + cap_add: + - NET_ADMIN + ports: + - 80:80 + - 443:443 + - 443:443/udp + - 8443:8443 + - 8443:8443/udp + volumes: + - $PWD/Caddyfile:/etc/caddy/Caddyfile + - caddy_data:/data + - caddy_config:/config + webserver: + container_name: sac_webserver + build: + context: backend + env_file: + - .env + +volumes: + caddy_data: + external: true + caddy_config: \ No newline at end of file