From 5430b08aa86fef31d176f9c0f8b8bf672508e90d Mon Sep 17 00:00:00 2001 From: Mariana Sartorato Date: Mon, 1 Jul 2024 16:24:22 -0300 Subject: [PATCH 1/3] fix: pyproject.toml - add package - change --no-dev to --only main --- backend/Dockerfile | 2 +- backend/pyproject.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index ccd04ba..bbb8ac1 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -25,7 +25,7 @@ COPY . /backend COPY ./utils/docker/entrypoint.sh /entrypoint.sh WORKDIR /backend -RUN poetry install --no-interaction --no-dev +RUN poetry install --no-interaction --only main ENV DJANGO_APP="kernelCI" diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 6f504e4..5e4afd9 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -4,6 +4,7 @@ version = "0.1.0" description = "Django Backend" authors = ["Your Name "] readme = "README.md" +packages = [{ include = 'kernelCI' }] [tool.poetry.dependencies] python = "^3.12" From 1355c40c130c47f4619e7f419ea900d362daef5f Mon Sep 17 00:00:00 2001 From: Mariana Sartorato Date: Tue, 2 Jul 2024 11:16:39 -0300 Subject: [PATCH 2/3] feat: add dashboard container --- collect_static/Dockerfile | 15 +++++++++++++++ dashboard/Dockerfile | 9 +++++++++ 2 files changed, 24 insertions(+) create mode 100644 collect_static/Dockerfile create mode 100644 dashboard/Dockerfile diff --git a/collect_static/Dockerfile b/collect_static/Dockerfile new file mode 100644 index 0000000..d79e680 --- /dev/null +++ b/collect_static/Dockerfile @@ -0,0 +1,15 @@ +FROM alpine:3.20 + +RUN export LANG=en_US.UTF-8 \ + && apk update \ + && apk upgrade \ + && apk add rsync \ + && rm -rf /var/cache/apk/* + +WORKDIR /data + +VOLUME ["/data/static/"] + +COPY --from=dashboard:latest /dashboard/dist /files + +CMD rsync -azvi --checksum --exclude='*.map' /files/ /data/static/ diff --git a/dashboard/Dockerfile b/dashboard/Dockerfile new file mode 100644 index 0000000..0b4b3d4 --- /dev/null +++ b/dashboard/Dockerfile @@ -0,0 +1,9 @@ +FROM node:22.3-alpine + +WORKDIR /dashboard + +COPY package.json pnpm-lock.yaml ./ +RUN npm install -g pnpm && pnpm install --frozen-lockfile + +COPY . ./ +RUN pnpm build From e69512202a007b40112bee2cdcb9f690a9310c12 Mon Sep 17 00:00:00 2001 From: Mariana Sartorato Date: Tue, 2 Jul 2024 11:19:17 -0300 Subject: [PATCH 3/3] feat: update docker-compose and proxy dockerfile closes #44 --- docker-compose.yml | 16 ++++++++++++++++ proxy/Dockerfile | 2 ++ proxy/etc/nginx/templates/default.conf.template | 6 +++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index fae52eb..c35ffb6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,7 @@ volumes: db-data: runtime-data: + static-data: networks: public: @@ -47,6 +48,19 @@ services: - DB_DEFAULT_PASSWORD_FILE=/run/secrets/postgres_password_secret - DB_DEFAULT_HOST=db + dashboard: + build: ./dashboard + restart: always + image: dashboard:latest + + collect_static: + build: './collect_static' + image: collect_static:latest + depends_on: + - dashboard + volumes: + - static-data:/data/static + proxy: build: ./proxy restart: always @@ -54,6 +68,8 @@ services: - backend networks: - public + volumes: + - static-data:/data/static ports: - target: 80 published: 80 diff --git a/proxy/Dockerfile b/proxy/Dockerfile index 5285c26..f3f19ba 100644 --- a/proxy/Dockerfile +++ b/proxy/Dockerfile @@ -1,3 +1,5 @@ FROM nginx:1.27.0-alpine +VOLUME ["/data/static"] + COPY etc/ /etc/ diff --git a/proxy/etc/nginx/templates/default.conf.template b/proxy/etc/nginx/templates/default.conf.template index fc23d2a..12826f0 100644 --- a/proxy/etc/nginx/templates/default.conf.template +++ b/proxy/etc/nginx/templates/default.conf.template @@ -1,5 +1,9 @@ server { - location / { + location /api { proxy_pass ${PROXY_TARGET}; } + location /{ + root /data/static; + try_files $uri /index.html; + } }