mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 10:22:16 +00:00
fix(tools): consolidate docker compose setup (#62525)
This commit is contained in:
committed by
GitHub
parent
f002f1b835
commit
3cbe2ab8b1
@@ -1,14 +0,0 @@
|
||||
services:
|
||||
api:
|
||||
restart: unless-stopped
|
||||
image: fcc-api
|
||||
env_file:
|
||||
- ../../.env
|
||||
ports:
|
||||
- '3000:3000'
|
||||
logging:
|
||||
driver: 'local'
|
||||
options:
|
||||
max-size: '10m'
|
||||
max-file: '3'
|
||||
compress: 'true'
|
||||
@@ -0,0 +1,19 @@
|
||||
# Docker Compose override for E2E testing
|
||||
# Usage: docker compose -f docker/docker-compose.yml -f docker/docker-compose.e2e.yml up -d
|
||||
services:
|
||||
api:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- db
|
||||
- mailpit
|
||||
image: fcc-api
|
||||
env_file:
|
||||
- ../.env
|
||||
environment:
|
||||
# The api cannot connect to mongodb or mailpit via localhost from inside the
|
||||
# container, so we have to override these variables.
|
||||
- MONGOHQ_URL=mongodb://db:27017/freecodecamp?directConnection=true
|
||||
- MAILHOG_HOST=mailpit
|
||||
- HOST=0.0.0.0
|
||||
ports:
|
||||
- '3000:3000'
|
||||
@@ -0,0 +1,41 @@
|
||||
services:
|
||||
db:
|
||||
image: mongo
|
||||
container_name: mongodb
|
||||
command: mongod --replSet rs0
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 27017:27017
|
||||
volumes:
|
||||
- db-data:/data/db
|
||||
healthcheck:
|
||||
test: ['CMD', 'mongosh', '--eval', "db.adminCommand('ping')"]
|
||||
interval: 2s
|
||||
retries: 5
|
||||
|
||||
setup:
|
||||
image: mongo
|
||||
depends_on:
|
||||
db:
|
||||
condition: service_healthy
|
||||
restart: on-failure
|
||||
# This will try to initiate the replica set, until it succeeds twice (i.e. until the replica set is already initialized)
|
||||
command: >
|
||||
mongosh --host db:27017 --eval '
|
||||
try {
|
||||
rs.initiate();
|
||||
} catch (err) {
|
||||
if(err.codeName !== "AlreadyInitialized") throw err;
|
||||
}
|
||||
'
|
||||
|
||||
mailpit:
|
||||
restart: unless-stopped
|
||||
image: axllent/mailpit
|
||||
ports:
|
||||
- '1025:1025'
|
||||
- '8025:8025'
|
||||
|
||||
volumes:
|
||||
db-data:
|
||||
driver: local
|
||||
Reference in New Issue
Block a user