fix: enforce amd64 container deployment
This commit is contained in:
1 parent
6141033d3c
commit
468591c84c
10 files changed
+36
-5
No files matched your search
+4
-2
@@ -11,6 +11,8 @@ variables:
|
||||
DOCKER_BUILDKIT: "1"
|
||||
DOCKER_TLS_CERTDIR: ""
|
||||
DOCKER_DRIVER: overlay2
|
||||
# The registry images and production Kubernetes nodes are amd64-only.
|
||||
DOCKER_DEFAULT_PLATFORM: linux/amd64
|
||||
# The runner fetches the repository before any job script runs. Retry transient
|
||||
# GitLab connectivity failures at that stage instead of failing the pipeline.
|
||||
GET_SOURCES_ATTEMPTS: "3"
|
||||
@@ -54,8 +56,8 @@ build:
|
||||
- echo "$DOCKER_PASSWORD" | docker login $DOCKER_REGISTRY -u "$DOCKER_USERNAME" --password-stdin
|
||||
|
||||
- export IMAGE_TAG="$CI_COMMIT_SHORT_SHA"
|
||||
- docker build --pull -t "$DOCKER_IMAGE_REPOSITORY:$IMAGE_TAG" -t "$DOCKER_IMAGE_REPOSITORY:latest" .
|
||||
- docker build --pull -f Dockerfile.gateway -t "$GATEWAY_IMAGE_REPOSITORY:$IMAGE_TAG" -t "$GATEWAY_IMAGE_REPOSITORY:latest" .
|
||||
- docker build --platform linux/amd64 --pull -t "$DOCKER_IMAGE_REPOSITORY:$IMAGE_TAG" -t "$DOCKER_IMAGE_REPOSITORY:latest" .
|
||||
- docker build --platform linux/amd64 --pull -f Dockerfile.gateway -t "$GATEWAY_IMAGE_REPOSITORY:$IMAGE_TAG" -t "$GATEWAY_IMAGE_REPOSITORY:latest" .
|
||||
- docker push "$DOCKER_IMAGE_REPOSITORY:$IMAGE_TAG"
|
||||
- docker push "$DOCKER_IMAGE_REPOSITORY:latest"
|
||||
- docker push "$GATEWAY_IMAGE_REPOSITORY:$IMAGE_TAG"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
- Keep VK tokens and group IDs out of the repository; use environment variables or Kubernetes Secrets.
|
||||
- Production manifests are already applied in namespace `belki`; CI deploys them from `main` using the namespace-scoped RBAC in [`deploy/k8s/rbac.yaml`](./deploy/k8s/rbac.yaml).
|
||||
- The production build uses the GitLab runner tag `fast`, a privileged Docker executor, and an explicit `docker:29.6.1-dind` service alias over TCP.
|
||||
- Production images and Kubernetes workloads are amd64-only. Preserve `linux/amd64` in Dockerfiles, CI build commands, and workload node selectors; do not reintroduce the arm64-only Python base tag.
|
||||
- When adding, removing, or updating a runtime dependency, rebuild and push the matching immutable base image to `reg.nyan404.ru`, then update its tag in the final Dockerfile before running CI. `requirements.txt` maps to `Dockerfile.base`; `nginx.conf` maps to `Dockerfile.gateway-base`.
|
||||
- Use Context7 for current official documentation when implementing or changing an external API, framework, or library integration.
|
||||
- Before adding or updating any dependency, use `prevent-eol` to check lifecycle support; do not treat its results as a vulnerability assessment.
|
||||
|
||||
+13
-1
@@ -1,4 +1,16 @@
|
||||
FROM reg.nyan404.ru/cwshed-clone/belki-base:py312-d6c42c4497ce
|
||||
# Production is deployed to amd64 nodes. Build dependencies from the official
|
||||
# base here because the previous private tag was published arm64-only.
|
||||
FROM --platform=linux/amd64 python:3.12-slim
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
LANG=C.UTF-8 \
|
||||
LC_ALL=C.UTF-8
|
||||
|
||||
WORKDIR /app
|
||||
COPY requirements.txt ./requirements.txt
|
||||
RUN python -m pip install --no-cache-dir --upgrade "pip==26.2.1" \
|
||||
&& python -m pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY app ./app
|
||||
COPY web ./web
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FROM python:3.12-slim
|
||||
FROM --platform=linux/amd64 python:3.12-slim
|
||||
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
FROM reg.nyan404.ru/cwshed/cwshed-base:nginx-c2431df29ccc
|
||||
FROM --platform=linux/amd64 reg.nyan404.ru/cwshed/cwshed-base:nginx-c2431df29ccc
|
||||
|
||||
COPY web /usr/share/nginx/html
|
||||
|
||||
|
||||
@@ -56,3 +56,6 @@
|
||||
# 2026-08-16 — несколько котят в прокачке
|
||||
|
||||
`CoachingSession.extra_kittens` теперь влияет на баллы сопровождающего через количество подопечных: 1-й ×1, 2-й ×1,5, каждый последующий ×1,15 (коэффициенты перемножаются), вместо сложения полной прибыли. Базовый коэффициент самостоятельности основного котёнка сохраняется. Веб-форма отправляет список `extra_kittens`; VK принимает `доп. котята: ...` в pipe-команде.
|
||||
# 2026-08-25: production container architecture
|
||||
|
||||
Production Belki images and Kubernetes workloads require `linux/amd64`. CI sets `DOCKER_DEFAULT_PLATFORM` and passes `--platform linux/amd64`; Dockerfiles and workload node selectors carry the same constraint. The previous private Python base tag `py312-d6c42c4497ce` was published only for arm64 and must not be used for the application image.
|
||||
@@ -17,6 +17,8 @@ spec:
|
||||
app.kubernetes.io/name: belki-web
|
||||
app.kubernetes.io/part-of: belki-calculator
|
||||
spec:
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: amd64
|
||||
containers:
|
||||
- name: web
|
||||
image: reg.nyan404.ru/cwshed-clone/belki:latest
|
||||
@@ -91,6 +93,8 @@ spec:
|
||||
app.kubernetes.io/name: belki-bot
|
||||
app.kubernetes.io/part-of: belki-calculator
|
||||
spec:
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: amd64
|
||||
containers:
|
||||
- name: bot
|
||||
image: reg.nyan404.ru/cwshed-clone/belki:latest
|
||||
|
||||
@@ -17,6 +17,8 @@ spec:
|
||||
app.kubernetes.io/name: cwshed
|
||||
app.kubernetes.io/part-of: belki-calculator
|
||||
spec:
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: amd64
|
||||
imagePullSecrets:
|
||||
- name: reg-nyan404
|
||||
containers:
|
||||
|
||||
@@ -29,6 +29,8 @@ spec:
|
||||
app.kubernetes.io/name: belki-postgres
|
||||
app.kubernetes.io/part-of: belki-calculator
|
||||
spec:
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: amd64
|
||||
imagePullSecrets:
|
||||
- name: reg-nyan404
|
||||
containers:
|
||||
@@ -96,6 +98,8 @@ spec:
|
||||
app.kubernetes.io/name: belki-web
|
||||
app.kubernetes.io/part-of: belki-calculator
|
||||
spec:
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: amd64
|
||||
imagePullSecrets:
|
||||
- name: reg-nyan404
|
||||
containers:
|
||||
@@ -170,6 +174,8 @@ spec:
|
||||
app.kubernetes.io/name: belki-bot
|
||||
app.kubernetes.io/part-of: belki-calculator
|
||||
spec:
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: amd64
|
||||
imagePullSecrets:
|
||||
- name: reg-nyan404
|
||||
containers:
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
## Runtime / Deployment
|
||||
- GitLab CI runs the build job.
|
||||
- Production container architecture is explicitly `linux/amd64`: CI sets `DOCKER_DEFAULT_PLATFORM` and passes `--platform linux/amd64`, Dockerfiles pin the platform, and Kubernetes workloads select nodes labeled `kubernetes.io/arch: amd64`. The former private Python base tag was arm64-only and is no longer used by the application image.
|
||||
- The job targets GitLab runner tag `fast` and builds through a privileged `docker:29.6.1-dind` service at `DOCKER_HOST=tcp://docker:2375`, with an explicit `alias: docker` and `DOCKER_TLS_CERTDIR=""`.
|
||||
- Runtime dependency layers are prebuilt and stored in the private registry: `reg.nyan404.ru/cwshed-clone/belki-base:py312-d6c42c4497ce` contains Python 3.12, `pip 26.2.1`, and the current `requirements.txt`; `reg.nyan404.ru/cwshed/cwshed-base:nginx-c2431df29ccc` contains Nginx plus `nginx.conf`. Adding, removing, or updating a runtime dependency requires rebuilding/pushing and retagging the matching base image before CI; ordinary CI builds only copy application or static files.
|
||||
- The `ryzen-runner-dind` service on `root@10.3.1.168` has a valid Runner registration and its helper container can reach `https://git.nyan404.ru/`. On 2026-08-21 its malformed `DOCKER_AUTH_CONFIG` was removed and the pre-change configuration was backed up on the host as `/etc/gitlab-runner/config.toml.bak-20260821-1334`.
|
||||
|
||||
Reference in new issue
Block a user