Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docker compose #1131

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
6 changes: 6 additions & 0 deletions .docker/backend.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM node:17
EXPOSE 3000
COPY . /gitpay
WORKDIR /gitpay
RUN npm install
CMD ["npm", "run", "start"]
6 changes: 6 additions & 0 deletions .docker/frontend.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM node:17.3.0
EXPOSE 8082
COPY ./frontend /gitpay/frontend
WORKDIR /gitpay/frontend
RUN npm install
CMD ["npm", "run", "dev"]
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**/node_modules

.*
6 changes: 3 additions & 3 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"username": "postgres",
"password": "postgres",
"database": "gitpay_dev",
"host": "127.0.0.1",
"host": "db",
"port": 5432,
"dialect": "postgres",
"logging": false,
Expand All @@ -13,8 +13,8 @@
"username": "postgres",
"password": "postgres",
"database": "gitpay_test",
"host": "127.0.0.1",
"port": 5432,
"host": "db_test",
"port": 5433,
"dialect": "postgres",
"logging": false
}
Expand Down
10 changes: 5 additions & 5 deletions config/secrets.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const databaseDev = {
username: 'postgres',
password: 'postgres',
database: 'gitpay_dev',
host: '127.0.0.1',
host: 'db',
port: 5432,
dialect: 'postgres',
logging: false
Expand All @@ -16,8 +16,8 @@ const databaseTest = {
username: 'postgres',
password: 'postgres',
database: 'gitpay_test',
host: '127.0.0.1',
port: 5432,
host: 'db_test',
port: 5433,
dialect: 'postgres',
logging: false
}
Expand All @@ -27,7 +27,7 @@ const databaseProd = {
password: null,
database: process.env.DATABASE_URL,
schema: 'public',
host: '127.0.0.1',
host: 'db',
port: 5432,
dialect: 'postgres',
protocol: 'postgres'
Expand All @@ -38,7 +38,7 @@ const databaseStaging = {
password: null,
database: process.env.DATABASE_URL,
schema: 'public',
host: '127.0.0.1',
host: 'db',
port: 5432,
dialect: 'postgres',
protocol: 'postgres'
Expand Down
35 changes: 25 additions & 10 deletions docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,33 @@
version: '3.7'

services:
backend_test:
image: node:8.6
command: sh -c "npm install && npm run migrate-test && npm run test"
working_dir: /gitpay
volumes:
- .:/gitpay
container_name: backend_test
image: backend
command: bash -c "npm run migrate-test && npm run seed-test && npm run test"
build:
context: .
dockerfile: .docker/backend.dockerfile
environment:
- NODE_ENV=test
network_mode: host
- POSTGRES_PORT=5433
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=gitpay_test
- OAUTH_CLIENT_ID=fakeid
- OAUTH_CLIENT_SECRET=fakesecret
- PAYPAL_HOST="https://api.sandbox.paypal.com"

pull_policy: missing
depends_on:
- db_test
restart: "no"
ports:
- "3001:3000"

db_test:
container_name: db_test
image: postgres
environment:
pull_policy: missing
ports:
- "5433:5432"
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=gitpay_test
network_mode: host
52 changes: 29 additions & 23 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
version: '3.7'

services:
frontend:
image: node:8.6
command: sh -c "npm install && npm run dev"
working_dir: /gitpay/frontend
volumes:
- .:/gitpay
network_mode: host
db:
container_name: db
env_file:
- .env
image: postgres
pull_policy: missing
ports:
- "8082:8082"
expose:
- "8082"
- "5432:5432"

backend:
container_name: backend
image: backend
env_file:
- .env
image: node:8.6
command: sh -c "npm install && npm run migrate && npm run start"
working_dir: /gitpay
volumes:
- .:/gitpay
network_mode: host
command: bash -c 'npm run migrate && npm run seed && npm run start'
build:
context: .
dockerfile: .docker/backend.dockerfile
pull_policy: missing
ports:
- "3000:3000"
db:
env_file:
- .env
image: postgres
network_mode: host
restart: always
depends_on:
- db

frontend:
container_name: frontend
build:
context: .
dockerfile: .docker/frontend.dockerfile
pull_policy: missing
ports:
- "8082:8082"
depends_on:
- backend