WIP: Add dev environment using docker

This commit is contained in:
lagertonne 2024-11-01 20:42:13 +01:00
parent f9409bb823
commit d2a38b8327
4 changed files with 70 additions and 20 deletions

13
core/Dockerfile.dev Normal file
View file

@ -0,0 +1,13 @@
FROM python:3.11-bookworm
LABEL authors="lagertonne"
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY requirements.dev.txt /code/
COPY requirements.prod.txt /code/
RUN apt update && apt install -y mariadb-client
RUN pip install -r requirements.dev.txt
RUN pip install -r requirements.prod.txt
RUN pip install mysqlclient
COPY . /code/

31
docker-compose.dev.yml Normal file
View file

@ -0,0 +1,31 @@
services:
core:
build:
context: ./core
dockerfile: Dockerfile.dev
command: python manage.py runserver 0.0.0.0:8000
#environment:
# - DATABASE_URL
volumes:
- ./core:/code
ports:
- "8000:8000"
frontend:
build:
context: ./web
dockerfile: Dockerfile.dev
command: npm run serve
volumes:
- ./web:/web:ro
- /web/node_modules
ports:
- "8080:8080"
db:
image: mariadb
environment:
MARIADB_RANDOM_ROOT_PASSWORD: true
MARIADB_DATABASE: system3
MARIADB_USER: system3
MARIADB_PASSWORD: system3

6
web/Dockerfile.dev Normal file
View file

@ -0,0 +1,6 @@
FROM docker.io/node:22
RUN mkdir /web
WORKDIR /web
COPY package.json /web/
RUN npm install

View file

@ -7,25 +7,25 @@ module.exports = {
"Access-Control-Allow-Headers": "*", "Access-Control-Allow-Headers": "*",
"Access-Control-Allow-Methods": "*" "Access-Control-Allow-Methods": "*"
}, },
proxy: { //proxy: {
'^/media/2': { // '^/media/2': {
target: 'https://staging.c3lf.de/', // target: 'https://staging.c3lf.de/',
changeOrigin: true // changeOrigin: true
}, // },
'^/api/2': { // '^/api/2': {
target: 'https://staging.c3lf.de/', // target: 'https://staging.c3lf.de/',
changeOrigin: true, // changeOrigin: true,
}, // },
'^/api/1': { // '^/api/1': {
target: 'https://staging.c3lf.de/', // target: 'https://staging.c3lf.de/',
changeOrigin: true, // changeOrigin: true,
}, // },
'^/ws/2': { // '^/ws/2': {
target: 'http://127.0.0.1:8082/', // target: 'http://127.0.0.1:8082/',
//changeOrigin: true, // //changeOrigin: true,
ws: true, // ws: true,
logLevel: 'debug', // logLevel: 'debug',
}, // },
} //}
} }
} }