Uses prebuilt server image
Simplifies deployment by using a prebuilt Docker image for the server. Removes build configuration and related port mappings from the compose file, relying on the image configuration instead. Also adds a compose template file with the original configuration.
This commit is contained in:
16
compose.yaml
16
compose.yaml
@@ -1,12 +1,10 @@
|
|||||||
services:
|
services:
|
||||||
server:
|
server:
|
||||||
build:
|
image: docker.registry.computerliebe.org/battleship
|
||||||
context: .
|
|
||||||
target: final
|
|
||||||
environment:
|
environment:
|
||||||
DATABASE_URL: postgres://postgres:${DATABASE_PASSWORD}@db:5432/${DATABASE_NAME}
|
DATABASE_URL: postgres://postgres:${DATABASE_PASSWORD}@db:5432/${DATABASE_NAME}
|
||||||
ports:
|
# ports:
|
||||||
- 3000:3000
|
# - 3000:3000
|
||||||
depends_on:
|
depends_on:
|
||||||
db:
|
db:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
@@ -20,10 +18,10 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
POSTGRES_DB: ${DATABASE_NAME}
|
POSTGRES_DB: ${DATABASE_NAME}
|
||||||
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
|
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
|
||||||
ports:
|
# ports:
|
||||||
- 5432:5432
|
# - 5432:5432
|
||||||
expose:
|
# expose:
|
||||||
- 5432
|
# - 5432
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "pg_isready" ]
|
test: [ "CMD", "pg_isready" ]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
|
34
compose.yaml.template
Normal file
34
compose.yaml.template
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
services:
|
||||||
|
server:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
target: final
|
||||||
|
environment:
|
||||||
|
DATABASE_URL: postgres://postgres:${DATABASE_PASSWORD}@db:5432/${DATABASE_NAME}
|
||||||
|
ports:
|
||||||
|
- 3000:3000
|
||||||
|
depends_on:
|
||||||
|
db:
|
||||||
|
condition: service_healthy
|
||||||
|
|
||||||
|
db:
|
||||||
|
image: postgres
|
||||||
|
restart: always
|
||||||
|
user: postgres
|
||||||
|
volumes:
|
||||||
|
- db-data:/var/lib/postgresql/data
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: ${DATABASE_NAME}
|
||||||
|
POSTGRES_PASSWORD: ${DATABASE_PASSWORD}
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
expose:
|
||||||
|
- 5432
|
||||||
|
healthcheck:
|
||||||
|
test: [ "CMD", "pg_isready" ]
|
||||||
|
interval: 10s
|
||||||
|
timeout: 5s
|
||||||
|
retries: 5
|
||||||
|
volumes:
|
||||||
|
db-data:
|
||||||
|
|
Reference in New Issue
Block a user