Skip to content

Commit

Permalink
Merge pull request #108 from atlp-rwanda/ft-docker
Browse files Browse the repository at this point in the history
implement Docker for project
  • Loading branch information
faid-terence authored May 31, 2024
2 parents bb96156 + f976460 commit 89ac0c5
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
npm-debug.log
Dockerfile
docker-compose.yml
.dockerignore
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:20-alpine

WORKDIR /app

COPY package.json .

RUN npm install

COPY . .

EXPOSE $PORT

CMD ["npm", "run", "dev"]
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,24 @@ logger.debug('This is a debug message');
npm test
```

### Setting up docker and using it

- Download and install docker
```
https://www.docker.com/products/docker-desktop/
```
- Download Subsystem for Linux for none linux users
- Set environment varibles like database host to postgresdb

- Building the image, you must navigate to the project directory in the terminal, then run
```
docker-compose up --build
```
- Stoping docker-compose container, run
```
docker-compose down
```

## Authors

- [Maxime Mizero](https://github.com/maxCastro1)
Expand Down
27 changes: 27 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: '3.8'

services:
postgresdb:
image: postgres
environment:
POSTGRES_USER: $DEV_DB_USER
POSTGRES_PASSWORD: $DEV_DB_PASS
POSTGRES_DB: $DEV_DB_NAME
volumes:
- knights-data:/var/lib/postgresql/data

node-app:
build: .
volumes:
- .:/app
- /app/node_modules
image: knights-app:1.0
env_file:
- ./.env
ports:
- $PORT:$PORT
depends_on:
- postgresdb

volumes:
knights-data:

0 comments on commit 89ac0c5

Please sign in to comment.