nochmal, nun alles docker-zeugs dabei
This commit is contained in:
3
backend/.env.docker
Normal file
3
backend/.env.docker
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Environment variables for Docker Compose
|
||||||
|
MONGO_ROOT_USER=root
|
||||||
|
MONGO_ROOT_PASSWD=SFluorit
|
||||||
18
backend/Dockerfile
Normal file
18
backend/Dockerfile
Normal 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"]
|
||||||
@@ -12,7 +12,48 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- mongodb_data:/data/db
|
- mongodb_data:/data/db
|
||||||
- mongodb_config:/data/configdb
|
- 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:
|
volumes:
|
||||||
mongodb_data:
|
mongodb_data:
|
||||||
mongodb_config:
|
mongodb_config:
|
||||||
|
|
||||||
|
networks:
|
||||||
|
app-network:
|
||||||
|
driver: bridge
|
||||||
5
frontend/.dockerignore
Normal file
5
frontend/.dockerignore
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
dist
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
18
frontend/Dockerfile
Normal file
18
frontend/Dockerfile
Normal 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"]
|
||||||
@@ -2,7 +2,8 @@
|
|||||||
"name": "aerzte",
|
"name": "aerzte",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.0",
|
"version": "1.0.0",
|
||||||
|
"vdate": "2025-11-23 11:00 UTC",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import AppointmentList from './components/AppointmentList';
|
|||||||
import './AppStyles.css';
|
import './AppStyles.css';
|
||||||
|
|
||||||
// Die Basis-URL der Express-API
|
// 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';
|
const API_URL = 'http://localhost:3001/api/appointments';
|
||||||
|
|
||||||
// Funktion zur Umwandlung von MongoDBs _id in die interne id des Frontends
|
// Funktion zur Umwandlung von MongoDBs _id in die interne id des Frontends
|
||||||
|
|||||||
@@ -4,4 +4,11 @@ import react from '@vitejs/plugin-react'
|
|||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
|
server: {
|
||||||
|
host: '0.0.0.0',
|
||||||
|
port: 5173,
|
||||||
|
watch: {
|
||||||
|
usePolling: true
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user