Skip to content

Commit

Permalink
Don't expose Docker ports and add .env for MongoDB.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitkonikov committed Feb 9, 2024
1 parent 975fbe1 commit e6449ea
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ echo " > docker compose down finished."

echo " > Copy .env"
cp ~/env/backend.env ~/cine/backend/.env
cp ~/env/mongodb.env ~/cine/mongodb/.env

# Start the Docker containers
echo " > Running docker compose up..."
Expand Down
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
version: '2.1'
services:
mongodb:
image: mongo:latest
ports:
- "27017:27017"
build:
context: ./mongodb
volumes:
- ~/data/db:/data/db
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD}
networks:
- gateway_app-net

Expand All @@ -15,8 +17,6 @@ services:
volumes:
- ~/_logs:/_logs
- ~/public:/public
ports:
- "3000:3000"
depends_on:
- mongodb
networks:
Expand Down
4 changes: 4 additions & 0 deletions mongodb/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM mongo:latest

ENV MONGO_INITDB_ROOT_USERNAME=${MONGO_INITDB_ROOT_USERNAME}
ENV MONGO_INITDB_ROOT_PASSWORD=${MONGO_INITDB_ROOT_PASSWORD}

0 comments on commit e6449ea

Please sign in to comment.