Add a docker dev environment that starts a container without building the image

+ Add dev.sh script to start the dev environment
+ Add generated flags to the .gitignore file
This commit is contained in:
Stephan
2021-12-03 10:21:43 +01:00
parent 6b6ca57639
commit 2b061c5f65
3 changed files with 43 additions and 1 deletions
+4 -1
View File
@@ -107,4 +107,7 @@ dist
prisma/migrations
# Ignore config files for docker
host/
host/
# Ignore flags
INITIALIZED
Executable
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
DATABASE_PASSWORD=server docker-compose up -d mail postgres redis
if [ ! "$(docker ps -a | grep server_dev)" ]; then
echo Creating "server_dev" container
docker run -it \
--name server_dev \
--mount type=bind,source="$(pwd)",target=/app \
--network server_default \
-p 3000:3000 -e PORT=3000 \
-e DATABASE_URL="postgresql://server:server@postgres:5432/management?schema=public" \
-e DATABASE_USER=server \
-e DATABASE_PASSWORD=server \
--entrypoint "/app/scripts/docker-entrypoint.dev.sh" \
node
else
echo "Container \"server_dev\" already exists; Starting container"
docker start -ia server_dev
fi
# After container termination
docker-compose stop
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
if ! test -f INITIALIZED; then
touch INITIALIZED
cd /app
npm i -g ts-node nodemon
npm i
npx prisma db push
fi
nodemon /app/src/app.ts