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

Merge branch 'backend-setup' into main

parents a43773fa 9ef7710a
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
# CLIENT
CLIENT_PORT=3000
......@@ -6,3 +6,6 @@ node_modules/
# .env files
.env
# Database
database-storage
......@@ -34,6 +34,16 @@ UI:
-Mantis
## Usage
### Docker
Firstly, run Docker daemon.
Navigate into the project root directory `pb138-film-database-group-project`.
Then in the root directory run `docker-compose up -d` to build, (re)create, start, and attach to containers for a service (optional flag `-d` runs containers in the background).
When you are finished, run `docker-compose down` to stop and remove containers, networks and images created by `up`.
## TODO
More TBA as features are implemented.
# Node modules folder
node_modules
# Git
.gitignore
# Database storage folder
database-storage
# 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", "build"]
version: '3.8'
services:
server:
container_name: server
image: server:1.0.0
build:
context: ./backend
dockerfile: Dockerfile
command: npm run start:debug
env_file: .env
ports:
- 127.0.0.1:${SERVER_PORT}:3000
volumes:
# 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-server:/usr/src/app/node_modules/
networks:
- backend-network
restart: always
depends_on:
- postgres
postgres:
container_name: postgres
image: postgres:14.3-alpine
env_file: .env
volumes:
- ./backend/database-storage:/var/lib/postgresql/data
networks:
- backend-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
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
volumes:
database-storage:
exclude-server:
exclude-client:
networks:
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"
},
......
......@@ -3,5 +3,10 @@ import react from '@vitejs/plugin-react'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()]
plugins: [react()],
server: {
watch: {
usePolling: true
}
}
})
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