-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4fcd5b4
commit 9c2d1f7
Showing
7 changed files
with
73 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,28 +2,27 @@ version: '3.8' | |
|
||
services: | ||
|
||
sample: | ||
web: | ||
env_file: | ||
- .env.docker | ||
container_name: sample | ||
- .env | ||
container_name: web | ||
build: | ||
context: ./portfolio | ||
dockerfile: ../Dockerfile | ||
target: build | ||
# comment out volumes when target is prod and not build | ||
# comment out volumes when target is prod | ||
volumes: | ||
- './portfolio:/app' | ||
# comment out until here | ||
# comment out ports in prod, traffic only through proxy | ||
ports: | ||
- 3001:80 | ||
- 3002:3001 | ||
- ${NODE_PORT}:${NODE_PORT} | ||
networks: | ||
- portfolio | ||
environment: | ||
- CHOKIDAR_USEPOLLING=true | ||
database: | ||
env_file: | ||
- .env.docker | ||
- .env | ||
image: postgres:16.2 | ||
environment: | ||
# using an .env file, but leaving defaults for easier first time run | ||
|
@@ -32,12 +31,39 @@ services: | |
POSTGRES_DB: ${POSTGRES_DB:-portfolio} | ||
volumes: | ||
- postgres:/data/postgres | ||
# comment out for prod, we don't need access | ||
ports: | ||
- "5433:5432" | ||
- 5433:${POSTGRES_PORT} | ||
networks: | ||
- portfolio | ||
restart: unless-stopped | ||
|
||
server: | ||
env_file: | ||
- .env | ||
environment: | ||
NGINX_ENVSUBST_TEMPLATE_SUFFIX: ".conf" | ||
build: | ||
context: ./portfolio/nginx | ||
dockerfile: Dockerfile | ||
ports: | ||
- 8005:${NGINX_PORT} | ||
# volumes: | ||
# - certbot-etc:/etc/letsencrypt | ||
# - certbot-var:/var/lib/letsencrypt | ||
depends_on: | ||
- web | ||
networks: | ||
- portfolio | ||
# certbot: | ||
# image: certbot/certbot | ||
# container_name: certbot | ||
# volumes: | ||
# - certbot-etc:/etc/letsencrypt | ||
# - certbot-var:/var/lib/letsencrypt | ||
# - web-root:/var/www/html | ||
# depends_on: | ||
# - web | ||
# command: certonly --webroot --webroot-path=/var/www/html --email [email protected] --agree-tos --no-eff-email --staging -d node.exampledomain.com | ||
networks: | ||
portfolio: | ||
driver: bridge | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM nginx:bookworm | ||
|
||
RUN rm /etc/nginx/conf.d/default.conf | ||
|
||
COPY nginx.conf /etc/nginx/templates/default.conf.conf | ||
|
||
# CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# upstream loadbalancer { | ||
# server localhost:3002; | ||
# } | ||
|
||
server { | ||
listen ${NGINX_PORT}; | ||
listen [::]:${NGINX_PORT}; | ||
|
||
server_name ${SERVER_NAME}; | ||
|
||
location ~ /.well-known/acme-challenge { | ||
allow all; | ||
root /var/www/html; | ||
} | ||
|
||
location / { | ||
proxy_pass http://web:${NODE_PORT}; | ||
# proxy_pass http://loadbalancer; | ||
|
||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters