Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Backend/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "run", "start:dev"]
45 changes: 45 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version: "3.9"

services:
postgres:
image: postgis/postgis:16-3.4-alpine
environment:
POSTGRES_USER: gistpin
POSTGRES_PASSWORD: gistpin
POSTGRES_DB: gistpin
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./infrastructure/docker/postgres-init.sql:/docker-entrypoint-initdb.d/01-init.sql:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U gistpin -d gistpin"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s

backend:
build:
context: ./Backend
dockerfile: Dockerfile.dev
ports:
- "3000:3000"
env_file:
- ./Backend/.env
environment:
NODE_ENV: development
DATABASE_HOST: postgres
DATABASE_PORT: "5432"
DATABASE_USER: gistpin
DATABASE_PASSWORD: gistpin
DATABASE_NAME: gistpin
volumes:
- ./Backend:/app
- /app/node_modules
depends_on:
postgres:
condition: service_healthy

volumes:
postgres_data:
17 changes: 10 additions & 7 deletions infrastructure/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ services:
dockerfile: ../infrastructure/docker/backend.Dockerfile
ports: ["3000:3000"]
environment:
NODE_ENV: development
DATABASE_URL: postgresql://gistpin:gistpin@postgres:5432/gistpin
NODE_ENV: production
DATABASE_HOST: postgres
DATABASE_PORT: "5432"
DATABASE_USER: gistpin
DATABASE_PASSWORD: gistpin
DATABASE_NAME: gistpin
depends_on:
postgres:
condition: service_healthy
volumes:
- ../../Backend:/app
- /app/node_modules

frontend:
build:
Expand All @@ -24,19 +25,21 @@ services:
depends_on: [backend]

postgres:
image: postgres:16-alpine
image: postgis/postgis:16-3.4-alpine
environment:
POSTGRES_USER: gistpin
POSTGRES_PASSWORD: gistpin
POSTGRES_DB: gistpin
ports: ["5432:5432"]
healthcheck:
test: ["CMD-SHELL", "pg_isready -U gistpin"]
test: ["CMD-SHELL", "pg_isready -U gistpin -d gistpin"]
interval: 10s
timeout: 5s
retries: 5
start_period: 20s
volumes:
- postgres_data:/var/lib/postgresql/data
- ./postgres-init.sql:/docker-entrypoint-initdb.d/01-init.sql:ro

volumes:
postgres_data:
2 changes: 2 additions & 0 deletions infrastructure/docker/postgres-init.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- GistPin database bootstrap
CREATE EXTENSION IF NOT EXISTS postgis;
CREATE EXTENSION IF NOT EXISTS postgis_topology;
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
CREATE EXTENSION IF NOT EXISTS "pg_stat_statements";