Skip to content

Commit

Permalink
Optimised docker
Browse files Browse the repository at this point in the history
  • Loading branch information
vilnor committed Apr 24, 2024
1 parent 07d3300 commit 85ff1fa
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 31 deletions.
1 change: 0 additions & 1 deletion backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
node_modules
package-lock.json
5 changes: 0 additions & 5 deletions backend/.env

This file was deleted.

8 changes: 6 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@ FROM node:latest

WORKDIR /app

COPY . /app
COPY ./package.json /app
COPY ./package-lock.json /app
RUN npm ci

RUN npm install
COPY ./index.ts .
COPY ./db ./db
COPY ./routes ./routes

CMD ["npm", "run", "start"]
2 changes: 0 additions & 2 deletions backend/db/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Imports
import { Pool } from 'pg'

const dotenv = require('dotenv');

const pool = new Pool({
user: process.env.DB_USER,
host: process.env.DB_HOST,
Expand Down
6 changes: 3 additions & 3 deletions backend/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ services:
db:
image: postgres:latest
environment:
DB_USER: "postgres"
DB_PASSWORD: "postgres"
DB_DATABASE: "postgres"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
POSTGRES_DATABASE: "postgres"

adminer:
image: adminer
Expand Down
4 changes: 0 additions & 4 deletions backend/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import cors from 'cors';
import { routes } from './routes/index';
import * as db from './db/index';

const dotenv = require('dotenv');

dotenv.config();

const PORT: number = process.env.PORT ? parseInt(process.env.PORT) : 8080;

// Make the app
Expand Down
13 changes: 0 additions & 13 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"@types/pg": "^8.11.5",
"@types/uuid": "^9.0.8",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"express": "^4.19.2",
"pg": "^8.11.5",
"uuid": "^9.0.1"
Expand Down

0 comments on commit 85ff1fa

Please sign in to comment.