🐳 Add docker support

This commit is contained in:
2022-05-04 00:45:11 +02:00
parent 7ecff18efd
commit 856e514da7
3 changed files with 42 additions and 0 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
node_modules
server/node_modules
.env

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM node:lts-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci
WORKDIR /app/server
COPY server/package*.json ./
RUN npm ci
COPY server/prisma/schema.prisma ./prisma/schema.prisma
RUN npx prisma generate
WORKDIR /app
COPY ./ ./
WORKDIR /app/server
CMD ["node", "index.js"]

22
docker-compose.yml Normal file
View File

@ -0,0 +1,22 @@
version: "3"
services:
app:
build: .
ports:
- 3000:3000
environment:
- DATABASE_URL=postgresql://postgres:postgres@db:5432/postgres
depends_on:
- db
env_file:
- ./server/.env
command: /bin/sh -c "npx prisma db push && node index.js"
db:
image: postgres
environment:
- POSTGRES_PASSWORD=postgres
volumes:
- postgres-data:/var/lib/postgresql/data
volumes:
postgres-data: