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

Optimised docker #3

Merged
merged 1 commit into from
Apr 24, 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
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
Loading