nochmal, nun alles docker-zeugs dabei

This commit is contained in:
rxf
2025-11-23 12:28:41 +01:00
parent 6727fe91d9
commit 268b4dee18
8 changed files with 96 additions and 2 deletions

3
backend/.env.docker Normal file
View File

@@ -0,0 +1,3 @@
# Environment variables for Docker Compose
MONGO_ROOT_USER=root
MONGO_ROOT_PASSWD=SFluorit

18
backend/Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
FROM node:20-alpine
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source code
COPY . .
# Expose the application port
EXPOSE 3001
# Start the application
CMD ["npm", "run", "dev"]

View File

@@ -12,7 +12,48 @@ services:
volumes:
- mongodb_data:/data/db
- mongodb_config:/data/configdb
networks:
- app-network
backend:
build:
context: .
dockerfile: Dockerfile
container_name: backend
restart: unless-stopped
ports:
- "3001:3001"
environment:
- PORT=3001
- MONGO_URI=mongodb://${MONGO_ROOT_USER}:${MONGO_ROOT_PASSWD}@mongodb:27017/appointmentsdb?authSource=admin
depends_on:
- mongodb
volumes:
- ./src:/app/src
- ./package.json:/app/package.json
networks:
- app-network
frontend:
build:
context: ../frontend
dockerfile: Dockerfile
container_name: frontend
restart: unless-stopped
ports:
- "5173:5173"
depends_on:
- backend
volumes:
- ../frontend/src:/app/src
- ../frontend/package.json:/app/package.json
networks:
- app-network
volumes:
mongodb_data:
mongodb_config:
mongodb_config:
networks:
app-network:
driver: bridge

5
frontend/.dockerignore Normal file
View File

@@ -0,0 +1,5 @@
node_modules
npm-debug.log
dist
.git
.gitignore

18
frontend/Dockerfile Normal file
View File

@@ -0,0 +1,18 @@
FROM node:20-alpine
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install dependencies
RUN npm ci
# Copy source code
COPY . .
# Expose Vite dev server port
EXPOSE 5173
# Start Vite dev server
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]

View File

@@ -2,7 +2,8 @@
"name": "aerzte",
"type": "module",
"private": true,
"version": "0.0.0",
"version": "1.0.0",
"vdate": "2025-11-23 11:00 UTC",
"scripts": {
"dev": "vite",
"build": "vite build",

View File

@@ -4,6 +4,7 @@ import AppointmentList from './components/AppointmentList';
import './AppStyles.css';
// Die Basis-URL der Express-API
// Always use localhost because the browser runs on the host machine
const API_URL = 'http://localhost:3001/api/appointments';
// Funktion zur Umwandlung von MongoDBs _id in die interne id des Frontends

View File

@@ -4,4 +4,11 @@ import react from '@vitejs/plugin-react'
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
server: {
host: '0.0.0.0',
port: 5173,
watch: {
usePolling: true
}
}
})