docker config

This commit is contained in:
2025-08-11 17:10:06 +02:00
parent 6a4cce9048
commit 38b53c80a5
6 changed files with 66 additions and 1 deletions

10
backend/Dockerfile Normal file
View File

@@ -0,0 +1,10 @@
FROM python:3.12-slim
WORKDIR /app
COPY backend/requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt
COPY backend /app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

18
docker-compose.yml Normal file
View File

@@ -0,0 +1,18 @@
version: "3.9"
services:
backend:
build:
context: .
dockerfile: backend/Dockerfile
container_name: my-backend
restart: unless-stopped
frontend:
build:
context: .
dockerfile: frontend/Dockerfile
container_name: my-frontend
ports:
- "6080:80"
restart: unless-stopped

17
frontend/Dockerfile Normal file
View File

@@ -0,0 +1,17 @@
# Etap 1: Build Vue
FROM node:20 AS build
WORKDIR /app
COPY frontend/package*.json ./
RUN npm install
COPY frontend ./
RUN npm run build
# Etap 2: Nginx serwujący Vue + proxy do backendu
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
# Konfiguracja Nginx z proxy
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]

19
frontend/nginx.conf Normal file
View File

@@ -0,0 +1,19 @@
server {
listen 80;
# Serwowanie plików Vue
location /odoo/ {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
# Proxy do backendu (niewidoczny z zewnątrz)
location /odoo/api/ {
proxy_pass http://backend:8000/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

View File

@@ -4,7 +4,7 @@ import router from '@/router'
import { useAuthStore } from '@/stores/authStore'
const api = axios.create({
baseURL: 'http://localhost:8000', // Twój backend
baseURL: '/odoo/api', // Twój backend
})
// Request interceptor dodawanie tokena

View File

@@ -6,6 +6,7 @@ import vueDevTools from 'vite-plugin-vue-devtools'
// https://vite.dev/config/
export default defineConfig({
base: '/odoo/',
plugins: [vue(), vueDevTools()],
resolve: {
alias: {