Skip to content
Snippets Groups Projects
Commit ddf6819c authored by Lukáš Kratochvíl's avatar Lukáš Kratochvíl
Browse files

feat: added to Docker - Postgres db and Adminer db manager, added .env-example...

feat: added to Docker - Postgres db and Adminer db manager, added .env-example as hint for local .env file
parent dd88f4d6
No related branches found
No related tags found
No related merge requests found
# SERVER
SERVER_PORT=4000
# DATABASE
DB_USER=admin
DB_PASSWORD=password
DB_NAME=film-db
# ADMINER
ADMINER_PORT=8080
...@@ -6,3 +6,6 @@ node_modules/ ...@@ -6,3 +6,6 @@ node_modules/
# .env files # .env files
.env .env
# Database
database-storage
# Node modules folder
node_modules
# Database storage folder
database-storage
# Docker files
Dockerfile
.dockerignore
FROM node:16-alpine FROM node:16-alpine
WORKDIR /usr/src/app WORKDIR /usr/src
COPY package*.json ./
COPY ["package.json", "package-lock.json*", "./"]
RUN npm install RUN npm install
ENV PATH=/usr/src/node_modules/.bin:$PATH
WORKDIR /usr/src/app
COPY . . COPY . .
......
version: '3.8' version: '3.8'
services: services:
server: server:
container_name: film_database-server container_name: server
image: film_database-server:1.0.0 image: server:1.0.0
build: build:
context: ./backend context: ./backend
dockerfile: Dockerfile dockerfile: Dockerfile
command: npm run start:dev command: npm run start:debug
ports: env_file: .env
- 127.0.0.1:3000:3000 ports:
networks: - 127.0.0.1:${SERVER_PORT}:3000
- app-network volumes:
volumes: # changes in host's ./backend directory will be propagated to the container
- ./backend:/usr/src/app - ./backend:/usr/src/app
- /usr/src/app/node_modules # this prevents our host files from overriding container's node_modules
restart: always - exclude:/usr/src/app/node_modules/
networks:
- app-network
restart: always
postgres:
container_name: postgres
image: postgres:14.3-alpine
env_file: .env
volumes:
- ./backend/database-storage:/var/lib/postgresql/data
networks:
- app-network
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME}
restart: always
adminer:
container_name: adminer
image: adminer:4.8.1
env_file: .env
ports:
- 127.0.0.1:${ADMINER_PORT}:${ADMINER_PORT}
environment:
ADMINER_DESIGN: nette
restart: always
depends_on:
- postgres-db
volumes:
exclude:
database-storage:
networks: networks:
app-network: app-network:
driver: bridge
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment