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

feat: Docker - added frontend to docker-compose

parent 5fd7c608
No related branches found
No related tags found
No related merge requests found
......@@ -8,3 +8,6 @@ DB_NAME=film-db
# ADMINER
ADMINER_PORT=8080
# CLIENT
CLIENT_PORT=3000
......@@ -15,10 +15,12 @@ services:
# changes in host's ./backend directory will be propagated to the container
- ./backend:/usr/src/app
# this prevents our host files from overriding container's node_modules
- exclude:/usr/src/app/node_modules/
- exclude-server:/usr/src/app/node_modules/
networks:
- app-network
- backend-network
restart: always
depends_on:
- postgres-db
postgres:
container_name: postgres
......@@ -27,7 +29,7 @@ services:
volumes:
- ./backend/database-storage:/var/lib/postgresql/data
networks:
- app-network
- backend-network
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
......@@ -46,9 +48,28 @@ services:
depends_on:
- postgres-db
client:
container_name: client
image: client:1.0.0
build:
context: ./frontend
dockerfile: Dockerfile
env_file: .env
ports:
- 127.0.0.1:${CLIENT_PORT}:3000
volumes:
# changes in host's ./frontend directory will be propagated to the container
- ./frontend:/usr/src/app
# this prevents our host files from overriding container's node_modules
- exclude-client:/usr/src/app/node_modules/
restart: always
depends_on:
- server
volumes:
exclude:
database-storage:
exclude-server:
exclude-client:
networks:
app-network:
backend-network:
# Node modules folder
node_modules
# Git
.gitignore
# Docker files
Dockerfile
.dockerignore
FROM node:16-alpine
WORKDIR /usr/src
COPY ["package.json", "package-lock.json*", "./"]
RUN npm install
ENV PATH=/usr/src/node_modules/.bin:$PATH
WORKDIR /usr/src/app
COPY . .
CMD ["npm", "run", "dev"]
......@@ -3,7 +3,7 @@
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite",
"dev": "vite --host",
"build": "tsc && vite build",
"preview": "vite preview"
},
......
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