Skip to content
Draft
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: 1 addition & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
31 changes: 9 additions & 22 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,19 @@
FROM node:16-slim as builder
FROM node:24.0-slim

RUN apt-get update && apt-get install -y openssl
RUN apt-get update && apt-get install -y openssl apt-utils

WORKDIR /backend

COPY src ./src
COPY prisma ./prisma
COPY *.json yarn.lock ./
RUN yarn install && yarn build
COPY src/views ./build/views

# Can't use node alpine because there is an issue with open SSL and Prisma
FROM node:16-slim AS camerapps

RUN apt-get update && apt-get install -y openssl
WORKDIR /app

ENV NODE_ENV=production
COPY backend/prisma/schema.prisma backend/*.json backend/*.lock ./
RUN yarn install

WORKDIR /app
COPY backend/* ./
COPY backend/src/views ./build/views

COPY --from=builder /backend/package.json /backend/yarn.lock ./
COPY --from=builder /backend/prisma ./prisma
COPY --from=builder /backend/node_modules ./node_modules
RUN yarn build

RUN mkdir -p public/images && chown node:node -R public

COPY --chown=node:node --from=builder /backend/build ./src

EXPOSE 8100

CMD ["yarn", "migrate:start:prod"]
CMD ["yarn", "migrate:start:prod"]
4 changes: 2 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"postinstall": "yarn db:generate"
},
"dependencies": {
"@prisma/client": "^4.5.0",
"@prisma/client": "^6.7.0",
"@types/js-yaml": "^4.0.5",
"axios": "^0.25.0",
"cors": "^2.8.5",
Expand Down Expand Up @@ -46,7 +46,7 @@
"eslint-plugin-typescript-sort-keys": "^2.1.0",
"nodemon": "^2.0.15",
"prettier": "^2.5.1",
"prisma": "^4.5.0",
"prisma": "^6.7.0",
"ts-node": "^10.4.0",
"typescript": "^4.5.5"
}
Expand Down
2 changes: 1 addition & 1 deletion backend/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ model Application {
genreId String @map("genre_id")

@@map("applications")
}
}
2,385 changes: 1,295 additions & 1,090 deletions backend/yarn.lock

Large diffs are not rendered by default.

53 changes: 33 additions & 20 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,55 @@ services:
db:
container_name: camerappsdb
image: mysql:8.0
restart: unless-stopped
restart: on-failure
networks:
- camerapps-network
volumes:
- "${DB_VOLUME_PATH:-~/camerapps}/db:/db/data"
- "${DB_VOLUME_PATH:-~/camerapps}/db:/var/lib/mysql"
ports:
- 3307:3306
environment:
- MYSQL_ROOT_PASSWORD=C4meroonWin3re
- MYSQL_DATABASE=kamer
networks:
- camerapps-network
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-C4meroonWin3re}
MYSQL_DATABASE: kamer
MYSQL_USER: ${MYSQL_USER:-root}
MYSQL_PASSWORD: ${MYSQL_PASSWORD:-C4meroonWin3re}
healthcheck:
test: ["CMD", "mysqladmin", "ping", "--silent"]
interval: 30s
timeout: 10s
retries: 5

api:
container_name: camerappsapi
build:
context: .
dockerfile: backend/Dockerfile
restart: unless-stopped
restart: on-failure
networks:
- camerapps-network
volumes:
- "${API_VOLUME_PATH:-~/camerapps}/api/logs:/app/logs"
- "${API_VOLUME_PATH:-~/camerapps}/api/public:/app/public"
ports:
- "8100:8100"
environment:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: normally i think we should relay on the same .env file used by prisma on generate... so having environment here seems not a good idea for me

- NODE_ENV=development
- SERVER_PORT=8100
- BASE_URL=http://localhost:8100
- DATABASE_URL=mysql://root:C4meroonWin3re@db:3306/kamer
- APP_NAME="Camer Apps API"
- WEB_URL=https://camerapps.com
- UPLOAD_FILE_PATH=./public/images
links:
- db
NODE_ENV: development
SERVER_PORT: 8100
BASE_URL: http://localhost:8100
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-C4meroonWin3re}
DATABASE_URL: mysql://${MYSQL_USER:-root}:${MYSQL_PASSWORD:-C4meroonWin3re}@db:3306/kamer
APP_NAME: "Camer Apps API"
WEB_URL: https://camerapps.com
UPLOAD_FILE_PATH: ./public/images
depends_on:
- db
networks:
- camerapps-network
db:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8100"]
interval: 30s
timeout: 10s
retries: 3

networks:
camerapps-network:
driver: bridge
driver: bridge
8 changes: 0 additions & 8 deletions yarn.lock

This file was deleted.