Added basic Docker support
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -10,3 +10,6 @@
|
||||
# production
|
||||
**/build
|
||||
**/npm-debug.log*
|
||||
|
||||
# Persistence Directory for Docker
|
||||
**/persist
|
||||
|
||||
7
Dockerfile
Normal file
7
Dockerfile
Normal file
@@ -0,0 +1,7 @@
|
||||
FROM node:lts-alpine
|
||||
RUN adduser jira-clone --gecos GECOS --shell /bin/bash --disabled-password --home /app
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
RUN npm run install-dependencies && \
|
||||
cp -v /app/docker/entrypoint.sh /usr/bin/entrypoint
|
||||
ENTRYPOINT ["entrypoint"]
|
||||
57
docker-compose.yml
Normal file
57
docker-compose.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
version: "3.4"
|
||||
|
||||
services:
|
||||
db:
|
||||
image: postgres:9.6-alpine
|
||||
restart: always
|
||||
environment:
|
||||
- POSTGRES_USER=jira-clone
|
||||
- POSTGRES_PASSWORD=jira-clone
|
||||
- POSTGRES_DB=jira-clone
|
||||
networks:
|
||||
- default
|
||||
volumes:
|
||||
- ./persist/db/git:/var/lib/postgresql/data
|
||||
|
||||
api:
|
||||
build: .
|
||||
restart: always
|
||||
environment:
|
||||
- NODE_ENV=development
|
||||
- DB_HOST=db
|
||||
- DB_PORT=5432
|
||||
- DB_USERNAME=jira-clone
|
||||
- DB_PASSWORD=jira-clone
|
||||
- DB_DATABASE=jira-clone
|
||||
## Please change this string to something unique.
|
||||
- JWT_SECRET=development12345
|
||||
command: ["api"]
|
||||
depends_on:
|
||||
- db
|
||||
networks:
|
||||
- default
|
||||
|
||||
client:
|
||||
build: .
|
||||
restart: always
|
||||
environment:
|
||||
ports:
|
||||
- 8080:8080
|
||||
networks:
|
||||
- default
|
||||
environment:
|
||||
- RUN_MODE=api
|
||||
- NODE_ENV=development
|
||||
- DB_HOST=localhost
|
||||
- DB_PORT=5432
|
||||
- DB_USERNAME=jira-clone
|
||||
- DB_PASSWORD=jira-clone
|
||||
- DB_DATABASE=jira-clone
|
||||
## Please change this string to something unique.
|
||||
- JWT_SECRET=development12345
|
||||
depends_on:
|
||||
- api
|
||||
command: ["client"]
|
||||
|
||||
networks:
|
||||
default:
|
||||
13
docker/entrypoint.sh
Executable file
13
docker/entrypoint.sh
Executable file
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env sh
|
||||
case $1 in
|
||||
api )
|
||||
cd /app/api/ && npm start
|
||||
;;
|
||||
client )
|
||||
cd /app/client && npm start
|
||||
;;
|
||||
* )
|
||||
echo "The only two supported run modes are client and api, giving you a shell instead."
|
||||
/bin/sh
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user