Skip to content
Open
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
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ LICENSE
.env
.env.template
.github
.git
.idea
.prettierignore
LICENSE.md
Expand Down
16 changes: 4 additions & 12 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,10 @@ jobs:
echo VERSION=develop >> $GITHUB_OUTPUT
fi

# Build Vue 3 frontend
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: yarn
cache-dependency-path: vue3/yarn.lock
- name: Install dependencies
working-directory: ./vue3
run: yarn install --frozen-lockfile
- name: Build dependencies
working-directory: ./vue3
run: yarn build
- name: Setup python
uses: actions/setup-python@v6
- name: Generate version.py
run: python version.py

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down
95 changes: 71 additions & 24 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,87 @@
# Build frontend
FROM node:22-alpine AS build
COPY --link ./vue3 /opt/recipes/vue3
WORKDIR /opt/recipes/vue3
RUN yarn install --frozen-lockfile && \
yarn build

# Main app image
FROM python:3.13-alpine3.22

#Install all dependencies.
RUN apk add --no-cache postgresql-libs postgresql-client gettext zlib libjpeg libwebp libxml2-dev libxslt-dev openldap git libgcc libstdc++ nginx tini envsubst nodejs npm
# Install all dependencies.
RUN apk add --no-cache \
envsubst \
gettext \
libgcc \
libjpeg \
libstdc++ \
libwebp \
libxml2-dev \
libxslt-dev \
nginx \
nodejs \
npm \
openldap \
postgresql-client \
postgresql-libs \
tini \
zlib

#Print all logs without buffering it.
ENV PYTHONUNBUFFERED=1 \
DOCKER=true

#This port will be used by gunicorn.
# This port will be used by gunicorn.
EXPOSE 80 8080

#Create app dir and install requirements.
RUN mkdir /opt/recipes
# Create app dir and install requirements.
WORKDIR /opt/recipes

COPY requirements.txt ./

# remove Development dependencies from requirements.txt
RUN sed -i '/# Development/,$d' requirements.txt
RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev openssl-dev libffi-dev cargo openldap-dev python3-dev xmlsec-dev xmlsec build-base g++ curl rust && \
python -m venv venv && \
/opt/recipes/venv/bin/python -m pip install --upgrade pip && \
venv/bin/pip debug -v && \
venv/bin/pip install wheel==0.45.1 && \
venv/bin/pip install setuptools_rust==1.10.2 && \
venv/bin/pip install -r requirements.txt --no-cache-dir &&\
COPY --link requirements.txt ./

RUN <<EOF
# remove Development dependencies from requirements.txt
sed -i '/# Development/,$d' requirements.txt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather out of scope for this PR, but I think the Python dev dependencies should be moved to another file to cleanly separate them, for example in requirements_dev.txt.

apk add --no-cache --virtual .build-deps \
build-base \
cargo \
curl \
g++ \
gcc \
jpeg-dev \
libffi-dev \
libwebp-dev \
musl-dev \
postgresql-dev \
python3-dev \
openldap-dev \
openssl-dev \
xmlsec \
xmlsec-dev \
rust \
zlib-dev
python -m venv venv
venv/bin/python -m pip install --upgrade pip
venv/bin/pip debug -v
venv/bin/pip install wheel==0.45.1
venv/bin/pip install setuptools_rust==1.10.2
venv/bin/pip install -r requirements.txt --no-cache-dir
apk --purge del .build-deps
EOF
Comment on lines +40 to +70
Copy link

@edysli edysli Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest moving building the venv to a separate stage. This way we would have one stage for the frontend and its build dependencies, one stage for the backend and its build dependencies, and one final image with runtime dependencies.


#Copy project and execute it.
COPY . ./
# Copy minimal parts of project to run
COPY --link ./recipes/ /opt/recipes/recipes
COPY --link ./cookbook/ /opt/recipes/cookbook
COPY --link ./http.d/ /opt/recipes/http.d
COPY --link --chmod=755 \
./boot.sh \
./manage.py \
/opt/recipes

# Add compiled frontend
COPY --link --from=build \
/opt/recipes/cookbook/static/vue3/ \
/opt/recipes/cookbook/static/vue3/

# delete default nginx config and link it to tandoors config
# create symlinks to access and error log to show them on stdout
Expand All @@ -44,10 +97,4 @@ RUN rm -rf /etc/nginx/http.d && \
# --retries=3 \
# CMD [ "/usr/bin/wget", "--no-verbose", "--tries=1", "--spider", "http://127.0.0.1:8080/openapi" ]

# collect information from git repositories
RUN /opt/recipes/venv/bin/python version.py
# delete git repositories to reduce image size
RUN find . -type d -name ".git" | xargs rm -rf

RUN chmod +x boot.sh
ENTRYPOINT ["/sbin/tini", "--", "/opt/recipes/boot.sh"]
Loading