Skip to content

Commit

Permalink
setup local
Browse files Browse the repository at this point in the history
  • Loading branch information
milon27 committed Mar 4, 2025
1 parent 4e2d8e4 commit 27d39d2
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ Dockerfile
/uploads

# .envs
.env
# .env
# .env.prod and account json for firebase should be allowed to copy into container otherwise how it will run
2 changes: 1 addition & 1 deletion .env.prod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ DATABASE_URL="mysql://root:myPassWord@localhost:3308/test" # test, test
# with ssl
# REDIS_URL="rediss://default:[email protected]:6379"
# without ssl
REDIS_URL="redis://default:1234567@redis:6379"
REDIS_URL="redis://default:1234567@np_redis:6379"
# redis cluster (not used)
REDIS_CLUSTER_ENABLE='false'
REDIS_CLUSTER_URLS="one,two,three"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN npm install -g pnpm
WORKDIR /app

# (set in docker compose file)
COPY --from=build /app/.env.dev ./.env
COPY --from=build /app/.env ./.env
COPY --from=build /app/package.json .
COPY --from=build /app/pnpm-lock.yaml .
COPY --from=build /app/resources ./resources
Expand Down
45 changes: 28 additions & 17 deletions docker-compose.local.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,49 @@
services:
mysql:
container_name: mysql
image: mysql:8.0.33
restart: always
environment:
- MYSQL_ROOT_PASSWORD=myPassWord
- MYSQL_DATABASE=test
ports:
- 3308:3306
volumes:
- db_vol:/var/lib/mysql
# - .backup-db:/docker-entrypoint-initdb.d
# mysql:
# container_name: mysql
# image: mysql:8.0.33
# restart: always
# environment:
# - MYSQL_ROOT_PASSWORD=myPassWord
# - MYSQL_DATABASE=test
# ports:
# - 3308:3306
# volumes:
# - db_vol:/var/lib/mysql
# - .backup-db:/docker-entrypoint-initdb.d

redis:
container_name: redis
np_redis:
container_name: np_redis
image: redis:7.4.1-alpine
restart: always
volumes:
- redis_vol:/data
environment:
- REDIS_PASSWORD=1234567
ports:
- 6379:6379
- 6380:6379
networks:
- np_network

api:
container_name: api
np_api:
container_name: np_api
depends_on:
- np_redis
build:
context: .
dockerfile: Dockerfile
target: prod
restart: always
ports:
- 4000:4000
networks:
- np_network

volumes:
db_vol:
redis_vol:

networks:
np_network:
name: np_network
driver: bridge
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
redis:
container_name: redis
np_redis:
container_name: np_redis
image: redis:7.4.1-alpine
restart: unless-stopped
volumes:
Expand All @@ -9,7 +9,7 @@ services:
- REDIS_PASSWORD=1234567
command: ["redis-server", "--requirepass", "1234567"]
ports:
- 6379:6379
- 6380:6379
networks:
- np_network

Expand Down

0 comments on commit 27d39d2

Please sign in to comment.