Skip to content

Instantly share code, notes, and snippets.

@mahdilamb
Created September 25, 2024 14:40
Show Gist options
  • Select an option

  • Save mahdilamb/62fa3e00b141c206a5137a9219819795 to your computer and use it in GitHub Desktop.

Select an option

Save mahdilamb/62fa3e00b141c206a5137a9219819795 to your computer and use it in GitHub Desktop.
compose with mkcert certificates
# Docker compose file for testing the build process locally
services:
frontend:
container_name: frontend
build:
context: .
args:
- NEXT_PUBLIC_LOCAL=http://localhost:8080
ports:
- "3000:3000"
- "8080:8080"
env_file: .env
healthcheck:
test: wget --no-verbose --tries=1 --spider http://frontend:3000 || exit 1
interval: 5s
start_period: 10s
timeout: 5s
retries: 3
reverse-proxy:
depends_on:
frontend:
condition: service_healthy
container_name: reverse-proxy
build:
dockerfile_inline: |
FROM nginx:latest
COPY <<EOF /etc/nginx/conf.d/vmo2.conf
server {
listen 80;
listen [::]:80;
server_name localhost;
location / {
proxy_pass http://frontend:3000;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name localhost;
ssl_certificate /etc/nginx/ssl/localhost.pem;
ssl_certificate_key /etc/nginx/ssl/localhost-key.pem;
location / {
proxy_pass http://frontend:3000;
}
}
EOF
ports:
- "80:80"
- "443:443"
volumes:
- ../certificates:/etc/nginx/ssl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment