updated Docker and docker-compose files

This commit is contained in:
2025-12-26 08:45:47 +01:00
parent 06788abe49
commit 2697aee592
8 changed files with 82 additions and 34 deletions
-6
View File
@@ -1,6 +0,0 @@
FROM node:21.6-alpine
WORKDIR /vue_app
expose 8080
CMD ["npm", "run", "serve"]
+16 -2
View File
@@ -1,5 +1,5 @@
# =========== 1) Build stage ===========
FROM golang:1.24-alpine AS builder
FROM golang:1.25-alpine AS builder
# Install necessary packages for CGO and SQLite
RUN apk add --no-cache gcc musl-dev sqlite-dev
@@ -17,7 +17,21 @@ COPY . .
RUN go build -v -o server cmd/main.go
# =========== 2) Runtime stage ===========
FROM alpine:3.18
FROM alpine:3.23
# Install Chromium for PDF rendering
RUN apk add --no-cache \
chromium \
chromium-chromedriver \
nss \
freetype \
harfbuzz \
ca-certificates \
ttf-freefont
# Set Chrome path for chromedp
ENV CHROME_BIN=/usr/bin/chromium-browser \
CHROME_PATH=/usr/bin/chromium-browser
WORKDIR /app
+5 -3
View File
@@ -1,10 +1,12 @@
# =========== 1) Build stage ===========
FROM node:18-alpine AS build
FROM node:22-alpine AS build
WORKDIR /usr/src/app
# Copy package manifests and install dependencies
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm install
# Copy the rest of the frontend code
@@ -19,7 +21,7 @@ FROM nginx:alpine
# Copy production build to Nginx html folder.
# Adjust /usr/src/app/build -> /usr/src/app/dist if youre using Angular/Vue
#COPY --from=build /usr/src/app/build /usr/share/nginx/html
COPY --from=build /usr/src/app /usr/share/nginx/html
COPY --from=build /usr/src/app/dist /usr/share/nginx/html
# Expose HTTP port
EXPOSE 80
+1 -1
View File
@@ -1,5 +1,5 @@
# Development Dockerfile für Vue.js Frontend
FROM node:18-alpine
FROM node:22-alpine
WORKDIR /app
+6 -6
View File
@@ -7,9 +7,6 @@ services:
container_name: bamort-backend-dev
ports:
- "8180:8180"
volumes:
- ../backend:/app
- go-mod-cache:/go/pkg/mod
environment:
- GO_ENV=development
- CGO_ENABLED=1
@@ -21,6 +18,9 @@ services:
working_dir: /app
# Restart if Go code changes cause crash
restart: unless-stopped
volumes:
- ../backend:/app
- go-mod-cache:/go/pkg/mod
frontend-dev:
build:
@@ -29,15 +29,15 @@ services:
container_name: bamort-frontend-dev
ports:
- "5173:5173" # Vite dev server port
volumes:
- ../frontend:/app
- /app/node_modules # Prevent overwriting node_modules
environment:
- NODE_ENV=development
- VITE_API_URL=${VITE_API_URL:-http://192.168.0.48:8180}
depends_on:
- backend-dev
restart: unless-stopped
volumes:
- ../frontend:/app
- /app/node_modules # Prevent overwriting node_modules
mariadb:
image: mariadb:11.4
+21 -16
View File
@@ -1,37 +1,42 @@
version: "3.8"
services:
backend:
build:
context: ../backend
dockerfile: ../docker/Dockerfile
container_name: backend
environment:
- DATABASE_TYPE=mysql
- DATABASE_URL=bamort:${MARIADB_PASSWORD:-secure_user_password}@tcp(mariadb:3306)/bamort?charset=utf8mb4&parseTime=True&loc=Local
dockerfile: ../docker/Dockerfile.backend
container_name: bamort-backend
ports:
- "8180:8180"
environment:
- GO_ENV=production
- CGO_ENABLED=1
- DATABASE_TYPE=mysql
- DATABASE_URL=bamort:${MARIADB_PASSWORD:-secure_user_password}@tcp(mariadb:3306)/bamort?charset=utf8mb4&parseTime=True&loc=Local
depends_on:
mariadb:
condition: service_healthy
working_dir: /app
restart: unless-stopped
frontend:
build:
context: ../frontend
dockerfile: ../docker/Dockerfile.frontend
container_name: frontend
container_name: bamort-frontend
ports:
- "5173:80"
environment:
- VITE_API_URL=${VITE_API_URL:-http://bamort.trokan.de:8180}
- BASE_URL=http://bamort.trokan.de:8180
- PORT=8180
- ENVIRONMENT=production
- DATABASE_TYPE=mysql
- DATABASE_URL=bamort:bG4)efozrc@tcp(mariadb:3306)/bamort?charset=utf8mb4&parseTime=True&loc=Local
- VITE_API_URL=${VITE_API_URL:-http://bamort.trokan.de:8180}
- BASE_URL=http://bamort.trokan.de
- PORT=8180
depends_on:
- backend
restart: unless-stopped
mariadb:
image: mariadb:11.4
@@ -51,8 +56,8 @@ services:
- ./init-db:/docker-entrypoint-initdb.d
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
start_period: 10s
timeout: 5s
start_period: 30s
timeout: 15s
retries: 3
# phpMyAdmin - Database Management (commented out for production)
@@ -74,5 +79,5 @@ services:
# mariadb:
# condition: service_healthy
volumes:
db_data:
#volumes:
# db_data:
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
echo "🚀 Starting Bamort Development Environment..."
# Prüfe ob Docker läuft
if ! docker info > /dev/null 2>&1; then
echo "❌ Docker ist nicht gestartet. Bitte starte Docker zuerst."
exit 1
fi
# Gehe ins Docker-Verzeichnis
cd "$(dirname "$0")"
echo "📦 Building and starting development containers..."
# Stoppe vorhandene Container
docker-compose -f docker-compose.yml down
# Baue und starte die Container
docker-compose -f docker-compose.yml up --build
echo "✅ Development environment stopped."
+11
View File
@@ -0,0 +1,11 @@
#!/bin/bash
echo "🛑 Stopping Bamort Development Environment..."
# Gehe ins Docker-Verzeichnis
cd "$(dirname "$0")"
# Stoppe und entferne Container
docker-compose -f docker-compose.yml down
echo "✅ Development environment stopped."