From de1147a5fea2af401538199bc4b827294b0d7ded Mon Sep 17 00:00:00 2001 From: jedi Date: Fri, 1 Nov 2024 23:40:55 +0100 Subject: [PATCH] add dev docker --- deploy/dev/Dockerfile.backend | 13 +++++++++++++ deploy/dev/Dockerfile.frontend | 6 ++++++ deploy/dev/docker-compose.yml | 33 +++++++++++++++++++++++++++++++++ deploy/dev/vue.config.js | 27 +++++++++++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 deploy/dev/Dockerfile.backend create mode 100644 deploy/dev/Dockerfile.frontend create mode 100644 deploy/dev/docker-compose.yml create mode 100644 deploy/dev/vue.config.js diff --git a/deploy/dev/Dockerfile.backend b/deploy/dev/Dockerfile.backend new file mode 100644 index 0000000..19c2efd --- /dev/null +++ b/deploy/dev/Dockerfile.backend @@ -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/deploy/dev/Dockerfile.frontend b/deploy/dev/Dockerfile.frontend new file mode 100644 index 0000000..0a41d1a --- /dev/null +++ b/deploy/dev/Dockerfile.frontend @@ -0,0 +1,6 @@ +FROM docker.io/node:22 + +RUN mkdir /web +WORKDIR /web +COPY package.json /web/ +RUN npm install diff --git a/deploy/dev/docker-compose.yml b/deploy/dev/docker-compose.yml new file mode 100644 index 0000000..95e8083 --- /dev/null +++ b/deploy/dev/docker-compose.yml @@ -0,0 +1,33 @@ +services: + core: + build: + context: ../../core + dockerfile: ../deploy/dev/Dockerfile.backend + command: bash -c 'python manage.py migrate && python manage.py runserver 0.0.0.0:8000' + environment: + - HTTP_HOST=core + #- DATABASE_URL + volumes: + - ../../core:/code + ports: + - "8000:8000" + + frontend: + build: + context: ../../web + dockerfile: ../deploy/dev/Dockerfile.frontend + command: npm run serve + volumes: + - ../../web:/web:ro + - /web/node_modules + - ./vue.config.js:/web/vue.config.js + 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/deploy/dev/vue.config.js b/deploy/dev/vue.config.js new file mode 100644 index 0000000..f8f3c26 --- /dev/null +++ b/deploy/dev/vue.config.js @@ -0,0 +1,27 @@ +// vue.config.js + +module.exports = { + devServer: { + headers: { + "Access-Control-Allow-Origin": "*", + "Access-Control-Allow-Headers": "*", + "Access-Control-Allow-Methods": "*" + }, + proxy: { + '^/media/2': { + target: 'http://core:8000/', + }, + '^/api/2': { + target: 'http://core:8000/', + }, + '^/api/1': { + target: 'http://core:8000/', + }, + '^/ws/2': { + target: 'http://core:8000/', + ws: true, + logLevel: 'debug', + }, + } + } +} \ No newline at end of file