edited docker and server config

This commit is contained in:
2026-05-29 23:39:18 +02:00
parent ec97102459
commit 1d7fb194fa
4 changed files with 79 additions and 4 deletions
+27
View File
@@ -0,0 +1,27 @@
services:
database:
container_name: stockhome-mysql
image: mysql:8.0
restart: unless-stopped
ports:
- "3312:3306"
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: stockhome
TZ: Europe/Berlin
volumes:
- ./.docker/volumes/stockhome_mysql:/var/lib/mysql
- ./mysql-timezone.cnf:/etc/mysql/conf.d/timezone.cnf:ro
backend:
container_name: stockhome-backend
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "8004:8004"
environment:
NODE_ENV: production
depends_on:
- database
restart: unless-stopped
+7 -4
View File
@@ -3,8 +3,6 @@ services:
container_name: stockhome-mysql
image: mysql:8.0
restart: unless-stopped
ports:
- "3312:3306"
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: stockhome
@@ -18,10 +16,15 @@ services:
build:
context: ./backend
dockerfile: Dockerfile
ports:
- "8004:8004"
environment:
NODE_ENV: production
depends_on:
- database
restart: unless-stopped
rontend:
container_name: stockhome-frontend
build: ./frontend
depends_on:
- backend
restart: unless-stopped
+19
View File
@@ -0,0 +1,19 @@
FROM node:22-alpine AS builder
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM nginx:alpine AS runner
WORKDIR /usr/share/nginx/html
COPY --from=builder /app/dist .
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
+26
View File
@@ -0,0 +1,26 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
location / {
try_files $uri $uri/ /index.html;
}
location = /backend {
return 301 /backend/;
}
location /backend/ {
proxy_pass http://stockhome-backend:8004/;
}
location ~* \.(?:js|mjs|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
expires 1y;
access_log off;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
}