From d2a38b8327762d8bd318e92173476517bbc2634f Mon Sep 17 00:00:00 2001 From: lagertonne Date: Fri, 1 Nov 2024 20:42:13 +0100 Subject: [PATCH] WIP: Add dev environment using docker --- core/Dockerfile.dev | 13 +++++++++++++ docker-compose.dev.yml | 31 +++++++++++++++++++++++++++++++ web/Dockerfile.dev | 6 ++++++ web/vue.config.js | 40 ++++++++++++++++++++-------------------- 4 files changed, 70 insertions(+), 20 deletions(-) create mode 100644 core/Dockerfile.dev create mode 100644 docker-compose.dev.yml create mode 100644 web/Dockerfile.dev diff --git a/core/Dockerfile.dev b/core/Dockerfile.dev new file mode 100644 index 0000000..0364fb8 --- /dev/null +++ b/core/Dockerfile.dev @@ -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/ \ No newline at end of file diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..23c2225 --- /dev/null +++ b/docker-compose.dev.yml @@ -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 \ No newline at end of file diff --git a/web/Dockerfile.dev b/web/Dockerfile.dev new file mode 100644 index 0000000..0a41d1a --- /dev/null +++ b/web/Dockerfile.dev @@ -0,0 +1,6 @@ +FROM docker.io/node:22 + +RUN mkdir /web +WORKDIR /web +COPY package.json /web/ +RUN npm install diff --git a/web/vue.config.js b/web/vue.config.js index 6a50fe3..007c1ff 100644 --- a/web/vue.config.js +++ b/web/vue.config.js @@ -7,25 +7,25 @@ module.exports = { "Access-Control-Allow-Headers": "*", "Access-Control-Allow-Methods": "*" }, - proxy: { - '^/media/2': { - target: 'https://staging.c3lf.de/', - changeOrigin: true - }, - '^/api/2': { - target: 'https://staging.c3lf.de/', - changeOrigin: true, - }, - '^/api/1': { - target: 'https://staging.c3lf.de/', - changeOrigin: true, - }, - '^/ws/2': { - target: 'http://127.0.0.1:8082/', - //changeOrigin: true, - ws: true, - logLevel: 'debug', - }, - } + //proxy: { + // '^/media/2': { + // target: 'https://staging.c3lf.de/', + // changeOrigin: true + // }, + // '^/api/2': { + // target: 'https://staging.c3lf.de/', + // changeOrigin: true, + // }, + // '^/api/1': { + // target: 'https://staging.c3lf.de/', + // changeOrigin: true, + // }, + // '^/ws/2': { + // target: 'http://127.0.0.1:8082/', + // //changeOrigin: true, + // ws: true, + // logLevel: 'debug', + // }, + //} } } \ No newline at end of file