Skip to content

Commit

Permalink
webserver compose
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-brennan2005 committed Jun 10, 2024
1 parent 4246fba commit 1877f8a
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
21 changes: 21 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
27 changes: 27 additions & 0 deletions deployment/docker-composes/webserver.yml
Original file line number Diff line number Diff line change
@@ -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:

0 comments on commit 1877f8a

Please sign in to comment.