Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: add dashboard container #45

Merged
merged 3 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
1 change: 1 addition & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.1.0"
description = "Django Backend"
authors = ["Your Name <[email protected]>"]
readme = "README.md"
packages = [{ include = 'kernelCI' }]

[tool.poetry.dependencies]
python = "^3.12"
Expand Down
15 changes: 15 additions & 0 deletions collect_static/Dockerfile
Original file line number Diff line number Diff line change
@@ -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/
9 changes: 9 additions & 0 deletions dashboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
volumes:
db-data:
runtime-data:
static-data:

networks:
public:
Expand Down Expand Up @@ -47,13 +48,28 @@ 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
depends_on:
- backend
networks:
- public
volumes:
- static-data:/data/static
ports:
- target: 80
published: 80
Expand Down
2 changes: 2 additions & 0 deletions proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
FROM nginx:1.27.0-alpine

VOLUME ["/data/static"]

COPY etc/ /etc/
6 changes: 5 additions & 1 deletion proxy/etc/nginx/templates/default.conf.template
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
server {
location / {
location /api {
proxy_pass ${PROXY_TARGET};
}
location /{
root /data/static;
try_files $uri /index.html;
}
}
Loading