Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement Docker for project #108

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Loading