[Docker] Allow overriding forwarded ports

This also makes images load on ports other than 3000 by default
This commit is contained in:
Earlopain 2023-09-25 18:21:08 +02:00
parent 8ad0e08a82
commit 156276f0c0
No known key found for this signature in database
GPG Key ID: 48860312319ADF61
3 changed files with 10 additions and 6 deletions

View File

@ -43,6 +43,11 @@
#
# COMPOSE_PROFILES=solargraph,discord
# Change the ports that are forwarded by docker to avoid potential conflicts
# EXPOSED_SERVER_PORT=3000
# EXPOSED_POSTGRES_PORT=34517
# The following environment variables are required when using the 'discord' profile:
# JOINER_BOT_TOKEN=

View File

@ -1,7 +1,7 @@
version: "3"
x-environment: &common-env
DANBOORU_HOSTNAME: http://localhost:3000
DANBOORU_HOSTNAME: http://localhost:${EXPOSED_SERVER_PORT:-3000}
DANBOORU_REDIS_URL: redis://redis
DANBOORU_ELASTICSEARCH_HOST: elastic
DANBOORU_MEMCACHED_SERVERS: memcached
@ -70,13 +70,12 @@ services:
- ./docker/default.conf.template:/etc/nginx/templates/default.conf.template
environment:
<<: *common-env
NGINX_HOST: localhost
NGINX_PORT: 3000
NGINX_PORT: ${EXPOSED_SERVER_PORT:-3000}
depends_on:
- autocompleted
- e621
ports:
- "3000:3000"
- "${EXPOSED_SERVER_PORT:-3000}:${EXPOSED_SERVER_PORT:-3000}"
postgres:
image: postgres:15-alpine
@ -87,7 +86,7 @@ services:
volumes:
- db_data:/var/lib/postgresql/data
ports:
- "34517:5432"
- "${EXPOSED_POSTGRES_PORT:-34517}:5432"
redis:
image: redis:7.0.10-alpine

View File

@ -1,6 +1,6 @@
server {
listen ${NGINX_PORT};
server_name ${NGINX_HOST};
server_name localhost;
root /app/public;
index index.html;
access_log off;