docker-compose in wsl

This commit is contained in:
Scott Hatlen (CTR)
2026-03-10 09:43:33 -07:00
parent a01005290a
commit 540a2ab2d9
6 changed files with 61 additions and 72 deletions

View File

@@ -11,15 +11,17 @@ logger = logging.getLogger(__name__)
class Config:
# Require SECRET_KEY in production, use random for dev
SECRET_KEY = os.environ.get("SECRET_KEY", os.urandom(32).hex())
# Require SECRET_KEY in production, use stable key for dev
SECRET_KEY = os.environ.get("SECRET_KEY", "dev-secret-key-1234567890")
# Fernet key — MUST be set via env var for data persistence
FERNET_KEY = os.environ.get("FERNET_KEY")
# Auth
AUTH_USERNAME = os.environ.get("AUTH_USERNAME", "admin")
AUTH_PASSWORD_HASH = os.environ.get("AUTH_PASSWORD_HASH", generate_password_hash("admin"))
AUTH_PASSWORD_HASH = os.environ.get(
"AUTH_PASSWORD_HASH", generate_password_hash("admin")
)
# Database
SQLALCHEMY_DATABASE_URI = os.environ.get("DATABASE_URL", "sqlite:///osa.db")
@@ -28,8 +30,13 @@ class Config:
# Session
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = "Lax"
SESSION_COOKIE_SECURE = os.environ.get("SESSION_COOKIE_SECURE", "false").lower() == "true"
SESSION_COOKIE_SECURE = (
os.environ.get("SESSION_COOKIE_SECURE", "false").lower() == "true"
)
SESSION_COOKIE_DOMAIN = os.environ.get("SESSION_COOKIE_DOMAIN", ".localhost")
PERMANENT_SESSION_LIFETIME = 28800 # 8 hours
# Docker-specific session settings
SESSION_TYPE = "filesystem"
# Upload limit
MAX_CONTENT_LENGTH = 50 * 1024 * 1024 # 50MB

39
docker-compose.yml Normal file
View File

@@ -0,0 +1,39 @@
services:
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: osa-backend
ports:
- "5001:5001"
volumes:
- ./backend:/app
- /app/.venv
environment:
- FLASK_ENV=development
- DATABASE_URL=sqlite:////app/osa.db
restart: unless-stopped
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
args:
- NODE_IMAGE=node:22-slim
container_name: osa-frontend
ports:
- "8080:5173"
volumes:
- ./frontend:/app
- /app/node_modules
environment:
- VITE_API_URL=/api
depends_on:
- backend
restart: unless-stopped
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
backend_data:
frontend_data:

View File

@@ -1,4 +1,5 @@
FROM node:22-slim AS build
ARG NODE_IMAGE=node:22-slim
FROM ${NODE_IMAGE}
WORKDIR /app
@@ -6,13 +7,18 @@ COPY package.json package-lock.json ./
RUN npm ci
COPY . .
# EXPOSE 5173
# CMD ["npm", "run", "dev", "--", "--host"]
RUN npm run build
FROM nginx:1.27-alpine
ARG NGINX_IMAGE=nginx:1.27-alpine
FROM ${NGINX_IMAGE}
COPY --from=build /app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 8080
CMD ["nginx", "-g", "daemon off;"]
CMD ["nginx", "-g", "daemon off;"]

View File

@@ -1,5 +1,5 @@
server {
listen 8080;
listen 5173;
server_name _;
root /usr/share/nginx/html;
index index.html;

View File

@@ -2252,9 +2252,6 @@
"cpu": [
"arm"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2268,9 +2265,6 @@
"cpu": [
"arm"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2284,9 +2278,6 @@
"cpu": [
"arm64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2300,9 +2291,6 @@
"cpu": [
"arm64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2316,9 +2304,6 @@
"cpu": [
"loong64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2332,9 +2317,6 @@
"cpu": [
"loong64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2348,9 +2330,6 @@
"cpu": [
"ppc64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2364,9 +2343,6 @@
"cpu": [
"ppc64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2380,9 +2356,6 @@
"cpu": [
"riscv64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2396,9 +2369,6 @@
"cpu": [
"riscv64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2412,9 +2382,6 @@
"cpu": [
"s390x"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2428,9 +2395,6 @@
"cpu": [
"x64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2444,9 +2408,6 @@
"cpu": [
"x64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2674,9 +2635,6 @@
"cpu": [
"arm64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2693,9 +2651,6 @@
"cpu": [
"arm64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2712,9 +2667,6 @@
"cpu": [
"x64"
],
"libc": [
"glibc"
],
"license": "MIT",
"optional": true,
"os": [
@@ -2731,9 +2683,6 @@
"cpu": [
"x64"
],
"libc": [
"musl"
],
"license": "MIT",
"optional": true,
"os": [
@@ -5932,9 +5881,6 @@
"cpu": [
"arm64"
],
"libc": [
"glibc"
],
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -5955,9 +5901,6 @@
"cpu": [
"arm64"
],
"libc": [
"musl"
],
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -5978,9 +5921,6 @@
"cpu": [
"x64"
],
"libc": [
"glibc"
],
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -6001,9 +5941,6 @@
"cpu": [
"x64"
],
"libc": [
"musl"
],
"license": "MPL-2.0",
"optional": true,
"os": [

View File

@@ -13,7 +13,7 @@ export default defineConfig({
server: {
proxy: {
'/api': {
target: 'http://localhost:5001',
target: 'http://backend:5001',
changeOrigin: true,
},
},