diff --git a/backend/mvnw b/backend/mvnw old mode 100644 new mode 100755 diff --git a/docker-compose.yml b/docker-compose.yml index 0a34a620c7..41a7183c65 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,64 +1,72 @@ -version: "3.8" +# Compose v3 ref: https://docs.docker.com/compose/compose-file/compose-file-v3/ +--- +version: "3.9" + +x-var: + - &POSTGRES_USER + postgres + - &POSTGRES_PASSWORD + default + - &POSTGRES_DATABASE + postgres + - &POSTGRES_HOST + database + +x-defaults: &defaults + logging: + driver: "json-file" + options: + max-size: 10m + max-file: "3" services: database: - container_name: postgres + container_name: *POSTGRES_HOST environment: - POSTGRES_USER: default - POSTGRES_PASSWORD: default - POSTGRES_DB: default - hostname: database + POSTGRES_USER: *POSTGRES_USER + POSTGRES_PASSWORD: *POSTGRES_PASSWORD + POSTGRES_DB: *POSTGRES_DATABASE image: postgres:15 - ports: - - "5432:5432" - restart: always - volumes: - - ./database/init-db.sh:/docker-entrypoint-initdb.d/init-db.sh - - /pgdata + ports: [5432:5432] + volumes: ["/pgdata"] healthcheck: - test: [ "CMD-SHELL", "pg_isready", "-d", "db_prod" ] + test: ["CMD", "pg_isready", "-U", *POSTGRES_USER] interval: 5s timeout: 10s retries: 10 - logging: - driver: "json-file" - options: - max-size: 10m - max-file: "3" + <<: *defaults backend: container_name: backend + image: maven:3.9.3-eclipse-temurin-17 + entrypoint: sh -c "cd /app && mvn -ntp spring-boot:run -Dspring-boot.run.jvmArguments='-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n'" environment: - POSTGRESQL_HOST: database - POSTGRESQL_USER: default - POSTGRESQL_PASSWORD: default - POSTGRESQL_DATABASE: default + POSTGRESQL_HOST: *POSTGRES_HOST + POSTGRESQL_USER: *POSTGRES_USER + POSTGRESQL_PASSWORD: *POSTGRES_PASSWORD + POSTGRESQL_DATABASE: *POSTGRES_DATABASE CHES_CLIENT_ID: id CHES_CLIENT_SECRET: secret CHES_TOKEN_URL: https://dev.loginproxy.gov.bc.ca/auth/realms/comsvcauth/protocol/openid-connect/token CHES_API_URL: https://ches-dev.api.gov.bc.ca/api/v1 - ports: - - 3000:3000 + ENV LANG: en_CA.UTF-8 + LANGUAGE: en_CA.UTF-8 + LC_ALL: en_CA.UTF-8 + ports: [3000:3000] healthcheck: test: ["CMD", "curl", "-f", "http://localhost:3000/health"] interval: 1m30s timeout: 10s retries: 3 start_period: 10s - hostname: backend - image: ghcr.io/bcgov/nr-forest-client/backend:517 - depends_on: - - database - links: - - database - logging: - driver: "json-file" - options: - max-size: 10m - max-file: "3" + depends_on: [*POSTGRES_HOST] + volumes: ["./backend:/app"] + <<: *defaults frontend: container_name: frontend + image: node:18-bullseye + entrypoint: sh -c "cd /app && npm i && npm start" environment: NODE_ENV: development VITE_BACKEND_URL: backend @@ -68,17 +76,10 @@ services: timeout: 10s retries: 3 start_period: 40s - hostname: frontend - image: ghcr.io/bcgov/nr-forest-client/frontend:500 - links: - - backend - ports: - - "8080:8080" - logging: - driver: "json-file" - options: - max-size: 10m - max-file: "3" + depends_on: [backend] + ports: [8080:8080] + volumes: ["./frontend:/app", "/app/node_modules"] + <<: *defaults legacydb: container_name: oracle @@ -86,24 +87,13 @@ services: APP_USER_PASSWORD: default APP_USER: THE ORACLE_RANDOM_PASSWORD: yes - hostname: legacydb platform: "linux/amd64" image: gvenzl/oracle-xe:21.3.0-slim-faststart - ports: - - 1521:1521 - restart: always - volumes: - - oracle:/opt/oracle/oradata gvenzl/oracle-xe + ports: [1521:1521] + volumes: [/opt/oracle/oradata gvenzl/oracle-xe] healthcheck: test: [ "CMD-SHELL", "healthcheck.sh" ] interval: 5s timeout: 10s retries: 10 - logging: - driver: "json-file" - options: - max-size: 10m - max-file: "3" - -volumes: - oracle: {} + <<: *defaults