Skip to content

Commit 28768c9

Browse files
authored
Create unified Docker image (#4631)
1 parent 445b706 commit 28768c9

File tree

10 files changed

+139
-264
lines changed

10 files changed

+139
-264
lines changed

.dockerignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,7 @@
55
!LICENSE
66
!MANIFEST.in
77
!docker/download_pretrained_weights.py
8+
!docker/nginx.conf
89
!.ci
10+
!backend
11+
!ui

.github/workflows/build.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ jobs:
4444
for TAG in $TAGS ; do
4545
TAG=${TAG} docker compose build
4646
47-
docker save -o geti-tune-backend-${TAG}.tar geti-tune-backend:${TAG}
48-
docker save -o geti-tune-ui-${TAG}.tar geti-tune-ui:${TAG}
47+
docker save -o geti-tune-${TAG}.tar geti-tune:${TAG}
4948
done
5049
env:
5150
TAGS: ${{ steps.meta.outputs.tags }}

backend/app/main.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# - uv run app/main.py
77
# or use docker and access UI and backend at geti-tune.localhost
88
# - docker compose up
9-
# - docker compose -f docker-compose.dev.yaml up
109

1110
import logging
1211
from pathlib import Path

docker/Dockerfile

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# syntax=docker/dockerfile:1.7
2+
3+
#######
4+
# Backend base
5+
#######
6+
FROM python:3.13-slim@sha256:6f79e7a10bb7d0b0a50534a70ebc78823f941fba26143ecd7e6c5dca9d7d7e8a AS backend-base
7+
COPY --from=docker.io/astral/uv:0.8.8@sha256:67b2bcccdc103d608727d1b577e58008ef810f751ed324715eb60b3f0c040d30 /uv /uvx /bin/
8+
9+
# Set working directory
10+
WORKDIR /app
11+
12+
ENV PYTHONPATH=/app
13+
14+
# Install system dependencies required for OpenCV
15+
RUN apt-get update && apt-get install -y --no-install-recommends \
16+
libgl1-mesa-glx=22.3.6-1+deb12u1 \
17+
libglib2.0-0=2.74.6-2+deb12u6 \
18+
&& rm -rf /var/lib/apt/lists/* \
19+
&& apt-get clean
20+
21+
# Install dependencies
22+
RUN --mount=type=cache,target=/root/.cache/uv \
23+
--mount=type=bind,source=backend/uv.lock,target=uv.lock \
24+
--mount=type=bind,source=backend/pyproject.toml,target=pyproject.toml \
25+
uv sync --frozen --no-editable
26+
27+
COPY backend/app ./app
28+
29+
#############
30+
# build_rest_api_specs
31+
#############
32+
FROM node:24-alpine3.22@sha256:7aaba6b13a55a1d78411a1162c1994428ed039c6bbef7b1d9859c25ada1d7cc5 AS build_rest_api_specs
33+
34+
WORKDIR /home/app/web_ui/
35+
36+
COPY --link ui/package.json .
37+
COPY --link ui/openapi.json /home/app/web_ui/src/api/openapi-spec.json
38+
RUN npm run build:api
39+
40+
#############
41+
# geti_ui_packages
42+
#############
43+
FROM node:24-alpine3.22@sha256:7aaba6b13a55a1d78411a1162c1994428ed039c6bbef7b1d9859c25ada1d7cc5 AS geti_ui_packags
44+
45+
WORKDIR /home/app/web_ui/
46+
RUN apk add --no-cache git=2.49.1-r0
47+
COPY --link ./ui/package.json ./
48+
RUN npm run clone-geti-ui-packages
49+
50+
#############
51+
# web_ui_deps
52+
#############
53+
FROM node:24-alpine3.22@sha256:7aaba6b13a55a1d78411a1162c1994428ed039c6bbef7b1d9859c25ada1d7cc5 AS base_web_ui
54+
55+
WORKDIR /home/app/web_ui/
56+
57+
COPY --link ui/package.json ./
58+
COPY --link ui/package-lock.json ./
59+
COPY --from=geti_ui_packags /home/app/web_ui/packages/ /home/app/web_ui/packages/
60+
RUN npm ci --audit=false --ignore-scripts
61+
62+
COPY --link ui/eslint.config.js ./
63+
COPY --link ui/.prettierrc ./
64+
COPY --link ui/tsconfig.json ./
65+
COPY --link ui/rsbuild.config.ts ./
66+
COPY --link ui/src/ src/
67+
68+
ARG PUBLIC_API_BASE_URL=""
69+
ENV PUBLIC_API_BASE_URL ${PUBLIC_API_BASE_URL}
70+
71+
#############
72+
# web_ui build
73+
#############
74+
FROM base_web_ui as web_ui
75+
RUN npm run build
76+
77+
#############
78+
# Server
79+
#############
80+
FROM backend-base AS geti-tune
81+
82+
# Install nginx
83+
RUN apt-get update && apt-get install -y --no-install-recommends \
84+
nginx=1.22.1-9+deb12u2 \
85+
&& rm -rf /var/lib/apt/lists/* \
86+
&& apt-get clean
87+
88+
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
89+
COPY --from=web_ui /home/app/web_ui/dist/ /usr/share/nginx/html
90+
91+
EXPOSE 80
92+
93+
CMD ["sh", "-c", "nginx; uv run ./app/main.py;"]

docker/Dockerfile.backend

Lines changed: 0 additions & 42 deletions
This file was deleted.

docker/Dockerfile.ui

Lines changed: 0 additions & 68 deletions
This file was deleted.

docker/docker-compose.dev.yaml

Lines changed: 0 additions & 108 deletions
This file was deleted.

0 commit comments

Comments
 (0)