add docker dev/prod variants

This commit is contained in:
b1ek 2023-03-10 17:39:12 +10:00
parent 960ccfc994
commit 2cda8b607e
Signed by: blek
GPG Key ID: 14546221E3595D0C
5 changed files with 75 additions and 2 deletions

8
.gitignore vendored
View File

@ -1,11 +1,15 @@
# package management # package management
node_modules node_modules
package-lock.json package-lock.json
pnpm-lock.yaml pnpm-lock.yml
yarn.lock yarn.lock
# env # env
.env .env
# code # code
!*.js !*.js
# docker
docker-compose.yml
Dockerfile

11
Dockerfile.dev Normal file
View File

@ -0,0 +1,11 @@
FROM node:19
WORKDIR /opt/code
COPY . /opt/code
RUN cat .gitignore | xargs rm -rf && \
npm i && \
./install
CMD [ "npm", "run", "dev" ]

11
Dockerfile.prod Normal file
View File

@ -0,0 +1,11 @@
FROM node:19
WORKDIR /opt/code
COPY . /opt/code
RUN cat .gitignore | xargs rm -rf && \
npm i --prod && \
./install
CMD [ "npm", "run", "prod" ]

47
docker-compose.dev Normal file
View File

@ -0,0 +1,47 @@
version: '3'
services:
server:
build:
context: .
dockerfile: Dockerfile
volumes:
- './:/opt/code'
ports:
- '${APP_PORT}:${APP_PORT}'
- '9229:9229'
env_file: ./.env
environment:
APP_PORT: '${APP_PORT}'
networks:
- homepage
redis:
image: redis:alpine
ports:
- '6379:6379'
networks:
- homepage
db:
image: postgres:alpine
ports:
- '5432:5432'
environment:
POSTGRES_PASSWORD: '${DB_PASSWORD}'
POSTGRES_USER: '${DB_USERNAME}'
POSTGRES_DB: '${DB_DATABASE}'
volumes:
- './data/db:/var/lib/postgresql'
networks:
- homepage
adminer:
image: adminer:standalone
ports:
- '8001:8080'
networks:
- homepage
environment:
ADMINER_DEFAULT_SERVER: postgres
ADMINER_DESIGN: rmsoft
networks:
homepage:
driver: bridge

0
docker-compose.prod Normal file
View File