From 8a6fb7ccdb608dc390422b94078089abc1e5b2f6 Mon Sep 17 00:00:00 2001 From: Peter Schuemann Date: Wed, 16 Jul 2025 23:40:37 +0200 Subject: [PATCH] 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. --- compose.yaml | 16 +++++++--------- compose.yaml.template | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 compose.yaml.template diff --git a/compose.yaml b/compose.yaml index ca6038b..10877c2 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,12 +1,10 @@ services: server: - build: - context: . - target: final + image: docker.registry.computerliebe.org/battleship environment: DATABASE_URL: postgres://postgres:${DATABASE_PASSWORD}@db:5432/${DATABASE_NAME} - ports: - - 3000:3000 + # ports: + # - 3000:3000 depends_on: db: condition: service_healthy @@ -20,10 +18,10 @@ services: environment: POSTGRES_DB: ${DATABASE_NAME} POSTGRES_PASSWORD: ${DATABASE_PASSWORD} - ports: - - 5432:5432 - expose: - - 5432 + # ports: + # - 5432:5432 + # expose: + # - 5432 healthcheck: test: [ "CMD", "pg_isready" ] interval: 10s diff --git a/compose.yaml.template b/compose.yaml.template new file mode 100644 index 0000000..ca6038b --- /dev/null +++ b/compose.yaml.template @@ -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: +