Skip to content

Commit 80502fe

Browse files
authored
chore (CI): fix all-in-one image build (baserow#4552)
* Fix versions in dockerfiles; remove all-in-one-dev * Add manual trigger to build all-in-one image * add build_args for all-in-one images
1 parent a4ddf3b commit 80502fe

File tree

13 files changed

+162
-287
lines changed

13 files changed

+162
-287
lines changed

.env.local.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ DJANGO_SETTINGS_MODULE=baserow.config.settings.dev
1414
# =============================================================================
1515
# Security (use simple values for local dev only!)
1616
# =============================================================================
17-
SECRET_KEY=local-dev-secret-key-not-for-production
18-
BASEROW_JWT_SIGNING_KEY=local-dev-jwt-key-not-for-production
17+
SECRET_KEY=baserow
18+
BASEROW_JWT_SIGNING_KEY=baserow
1919

2020
# =============================================================================
2121
# Database (local PostgreSQL)
@@ -70,5 +70,5 @@ MIGRATE_ON_STARTUP=false
7070
# =============================================================================
7171
# Media files (path relative to the backend folder)
7272
# =============================================================================
73-
MEDIA_ROOT=./media
73+
MEDIA_ROOT=media
7474
MEDIA_URL=http://localhost:8000/media/

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,7 @@ jobs:
874874
build-final-backend:
875875
name: Build Final Backend Image
876876
runs-on: ubuntu-latest
877-
if: needs.check-build-and-publish.outputs.should_build_and_publish == 'true' && (github.ref_name == 'develop' || github.ref_name == 'master')
877+
if: needs.check-build-and-publish.outputs.should_build_and_publish == 'true' && (github.ref_name == 'develop' || github.ref_name == 'master' || github.event_name == 'workflow_dispatch')
878878
needs:
879879
- test-backend
880880
- test-e2e
@@ -916,7 +916,7 @@ jobs:
916916
build-final-web-frontend:
917917
name: Build Final Web-Frontend Image
918918
runs-on: ubuntu-latest
919-
if: needs.check-build-and-publish.outputs.should_build_and_publish == 'true' && (github.ref_name == 'develop' || github.ref_name == 'master')
919+
if: needs.check-build-and-publish.outputs.should_build_and_publish == 'true' && (github.ref_name == 'develop' || github.ref_name == 'master' || github.event_name == 'workflow_dispatch')
920920
needs:
921921
- test-frontend
922922
- test-e2e
@@ -958,7 +958,7 @@ jobs:
958958
build-final-all-in-one:
959959
name: Build All-in-One Image
960960
runs-on: ubuntu-latest
961-
if: needs.check-build-and-publish.outputs.should_build_and_publish == 'true' && (github.ref_name == 'develop' || github.ref_name == 'master')
961+
if: needs.check-build-and-publish.outputs.should_build_and_publish == 'true' && (github.ref_name == 'develop' || github.ref_name == 'master' || github.event_name == 'workflow_dispatch')
962962
needs:
963963
- build-final-backend
964964
- build-final-web-frontend
@@ -999,7 +999,7 @@ jobs:
999999
build-cloudron:
10001000
name: Build Cloudron Image
10011001
runs-on: ubuntu-latest
1002-
if: needs.check-build-and-publish.outputs.should_build_and_publish == 'true' && (github.ref_name == 'develop' || github.ref_name == 'master')
1002+
if: needs.check-build-and-publish.outputs.should_build_and_publish == 'true' && (github.ref_name == 'develop' || github.ref_name == 'master' || github.event_name == 'workflow_dispatch')
10031003
needs:
10041004
- build-final-all-in-one
10051005
- check-build-and-publish

backend/Dockerfile

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
2828
# =============================================================================
2929
# Production base builder stage: builds runtime dependencies only
3030
# =============================================================================
31-
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim AS builder-prod-base
31+
FROM python:3.11.14-slim-bookworm AS builder-prod-base
3232
ARG UID
3333
ARG GID
3434

@@ -49,7 +49,10 @@ ENV UV_PYTHON_DOWNLOADS=0 \
4949
PYTHONUNBUFFERED=1 \
5050
PATH="/baserow/venv/bin:$PATH" \
5151
PYTHONPATH="/baserow/backend/src:/baserow/premium/backend/src:/baserow/enterprise/backend/src"
52-
52+
53+
# hadolint ignore=DL3022
54+
COPY --from=ghcr.io/astral-sh/uv:0.9.26 /uv /uvx /bin/
55+
5356
# Create baserow directory structure (including subdirs for COPY targets)
5457
RUN mkdir -p /baserow/ && chown -R $UID:$GID /baserow/
5558

@@ -84,14 +87,15 @@ ARG GID
8487
USER $UID:$GID
8588
WORKDIR /baserow/backend
8689

90+
COPY --chown=$UID:$GID LICENSE /baserow/LICENSE
91+
COPY --chown=$UID:$GID premium/LICENSE /baserow/premium/LICENSE
92+
COPY --chown=$UID:$GID enterprise/LICENSE /baserow/enterprise/LICENSE
93+
8794
# Install dev dependencies before copying source code to leverage caching
8895
RUN --mount=type=cache,target=$UV_CACHE_DIR,sharing=locked,uid=$UID,gid=$GID \
89-
--mount=type=bind,source=LICENSE,target=/baserow/LICENSE \
9096
--mount=type=bind,source=backend/uv.lock,target=/baserow/backend/uv.lock \
9197
--mount=type=bind,source=backend/pyproject.toml,target=/baserow/backend/pyproject.toml \
92-
--mount=type=bind,source=premium/LICENSE,target=/baserow/premium/LICENSE \
9398
--mount=type=bind,source=premium/backend/pyproject.toml,target=/baserow/premium/backend/pyproject.toml \
94-
--mount=type=bind,source=enterprise/LICENSE,target=/baserow/enterprise/LICENSE \
9599
--mount=type=bind,source=enterprise/backend/pyproject.toml,target=/baserow/enterprise/backend/pyproject.toml \
96100
uv sync --frozen --no-install-workspace --no-install-project \
97101
&& find /baserow/venv -type f \( -name "*.c" -o -name "*.h" \) -not -path "*/autobahn/*" -delete \
@@ -102,16 +106,12 @@ RUN --mount=type=cache,target=$UV_CACHE_DIR,sharing=locked,uid=$UID,gid=$GID \
102106
&& (find /baserow/venv/lib -type d \( -name "doc" -o -name "docs" -o -name "example" -o -name "examples" \) \
103107
-not -path "*/botocore/*" -not -path "*/boto3/*" -prune -exec rm -rf {} \; || true)
104108

105-
COPY --link --from=tool-builder /usr/bin/dos2unix /usr/local/bin/dos2unix
109+
COPY --from=tool-builder /usr/bin/dos2unix /usr/local/bin/dos2unix
106110

107111
# Copy source code and tests
108-
COPY --chown=$UID:$GID LICENSE /baserow/LICENSE
109-
COPY --chown=$UID:$GID backend /baserow/backend
110112

111-
COPY --chown=$UID:$GID premium/LICENSE /baserow/premium/LICENSE
113+
COPY --chown=$UID:$GID backend /baserow/backend
112114
COPY --chown=$UID:$GID premium/backend /baserow/premium/backend
113-
114-
COPY --chown=$UID:$GID enterprise/LICENSE /baserow/enterprise/LICENSE
115115
COPY --chown=$UID:$GID enterprise/backend /baserow/enterprise/backend
116116

117117
COPY --chown=$UID:$GID tests /baserow/tests
@@ -140,7 +140,7 @@ FROM builder-prod-base AS builder-prod
140140
ARG UID
141141
ARG GID
142142

143-
COPY --link --from=tool-builder /usr/bin/dos2unix /usr/local/bin/dos2unix
143+
COPY --from=tool-builder /usr/bin/dos2unix /usr/local/bin/dos2unix
144144

145145
USER $UID:$GID
146146
WORKDIR /baserow/backend
@@ -173,7 +173,7 @@ RUN --mount=type=cache,target=$UV_CACHE_DIR,sharing=locked,uid=$UID,gid=$GID \
173173
# =============================================================================
174174
# CI Target - lightweight image for pytest and E2E tests
175175
# =============================================================================
176-
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim AS ci
176+
FROM python:3.11.14-slim-bookworm AS ci
177177
ARG UID
178178
ARG GID
179179

@@ -196,15 +196,17 @@ ENV DOCKER_USER=baserow_docker_user \
196196
RUN groupadd --system --gid $GID ${DOCKER_USER} && \
197197
useradd --shell /bin/bash -l -u $UID -g $GID -o -c "" -d /baserow -m ${DOCKER_USER}
198198

199-
COPY --link --from=tool-builder /usr/local/bin/su-exec /usr/local/bin/su-exec
200-
COPY --link --from=tool-builder /usr/bin/tini /usr/bin/tini
199+
COPY --from=tool-builder /usr/local/bin/su-exec /usr/local/bin/su-exec
200+
COPY --from=tool-builder /usr/bin/tini /usr/bin/tini
201+
# hadolint ignore=DL3022
202+
COPY --from=ghcr.io/astral-sh/uv:0.9.26 /uv /uvx /bin/
201203

202204
# Create baserow directory structure (including subdirs for COPY targets)
203205
RUN mkdir -p /baserow/backend/reports /baserow/premium/backend /baserow/enterprise/backend /baserow/media && \
204206
chown -R $UID:$GID /baserow/
205207

206208
# Copy the virtual environment and source code with tests
207-
COPY --link --from=builder-ci /baserow /baserow
209+
COPY --chown=$UID:$GID --from=builder-ci /baserow /baserow
208210
COPY --chown=$UID:$GID deploy/plugins/*.sh /baserow/plugins/
209211

210212
USER $UID:$GID
@@ -217,7 +219,7 @@ ENTRYPOINT ["/usr/bin/tini", "--", "/bin/bash", "/baserow/backend/docker/docker-
217219
# Only works mounting the source code as a bind mount. See docker-compose.dev.yml for usage.
218220
# =============================================================================
219221

220-
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim AS dev
222+
FROM python:3.11.14-slim-bookworm AS dev
221223
ARG UID="9999"
222224
ARG GID="9999"
223225

@@ -258,9 +260,11 @@ RUN getent group $GID || groupadd --system --gid $GID ${DOCKER_USER} && \
258260
echo "${DOCKER_USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${DOCKER_USER} && \
259261
chmod 0440 /etc/sudoers.d/${DOCKER_USER}
260262

261-
COPY --link --from=tool-builder /usr/local/bin/su-exec /usr/local/bin/su-exec
262-
COPY --link --from=tool-builder /usr/bin/tini /usr/bin/tini
263-
COPY --link --from=tool-builder /usr/bin/dos2unix /usr/local/bin/dos2unix
263+
COPY --from=tool-builder /usr/local/bin/su-exec /usr/local/bin/su-exec
264+
COPY --from=tool-builder /usr/bin/tini /usr/bin/tini
265+
COPY --from=tool-builder /usr/bin/dos2unix /usr/local/bin/dos2unix
266+
# hadolint ignore=DL3022
267+
COPY --from=ghcr.io/astral-sh/uv:0.9.26 /uv /uvx /bin/
264268

265269
# Create directory structure to install dependencies
266270
RUN mkdir -p /baserow/backend/docker /baserow/premium/ /baserow/enterprise/ /baserow/media && \
@@ -280,11 +284,9 @@ RUN --mount=type=cache,target=$UV_CACHE_DIR,sharing=locked,uid=$UID,gid=$GID \
280284
--mount=type=bind,source=enterprise/backend/pyproject.toml,target=/baserow/enterprise/backend/pyproject.toml \
281285
uv sync --frozen --no-install-workspace --no-install-project
282286

283-
# Configure tmux to preserve environment variables (don't start login shell)
284-
RUN echo 'set -g default-command "${SHELL}"' > /baserow/.tmux.conf
285-
286-
# Create .bashrc with environment variables for interactive shells
287-
RUN printf '%s\n' \
287+
# Configure tmux and bashrc
288+
RUN echo "set -g default-command \"\${SHELL}\"" > /baserow/.tmux.conf && \
289+
printf '%s\n' \
288290
'# Aliases' \
289291
'alias j="just"' \
290292
'alias m="python /baserow/backend/src/baserow/manage.py"' \
@@ -311,7 +313,7 @@ CMD ["django-dev"]
311313
# =============================================================================
312314
# Production target
313315
# =============================================================================
314-
FROM python:3.11-slim-bookworm AS local
316+
FROM python:3.11.14-slim-bookworm AS local
315317
ARG UID
316318
ARG GID
317319

@@ -341,18 +343,18 @@ RUN groupadd --system --gid $GID ${DOCKER_USER} && \
341343

342344
# In slim docker images, mime.types is removed and we need it for mimetypes guessing
343345
COPY ./backend/docker/mime.types /etc/
344-
COPY --link --from=tool-builder /usr/local/bin/su-exec /usr/local/bin/su-exec
345-
COPY --link --from=tool-builder /usr/bin/tini /usr/bin/tini
346+
COPY --from=tool-builder /usr/local/bin/su-exec /usr/local/bin/su-exec
347+
COPY --from=tool-builder /usr/bin/tini /usr/bin/tini
346348

347349
RUN mkdir -p /baserow/media && chown -R $UID:$GID /baserow/
348350

349351
# Copy the virtual environment with the production dependencies
350-
COPY --link --from=builder-prod /baserow/venv /baserow/venv/
352+
COPY --chown=$UID:$GID --from=builder-prod /baserow/venv /baserow/venv/
351353

352354
COPY --chown=$UID:$GID LICENSE /baserow/LICENSE
353-
COPY --link --from=builder-prod /baserow/backend /baserow/backend/
354-
COPY --link --from=builder-prod /baserow/premium /baserow/premium/
355-
COPY --link --from=builder-prod /baserow/enterprise /baserow/enterprise/
355+
COPY --chown=$UID:$GID --from=builder-prod /baserow/backend /baserow/backend/
356+
COPY --chown=$UID:$GID --from=builder-prod /baserow/premium /baserow/premium/
357+
COPY --chown=$UID:$GID --from=builder-prod /baserow/enterprise /baserow/enterprise/
356358

357359
COPY --chown=$UID:$GID deploy/plugins/*.sh /baserow/plugins/
358360

0 commit comments

Comments
 (0)