Skip to content

Commit 2e57298

Browse files
committed
fix: address critical multi-arch and CI/CD issues
Critical fixes from expert review: - Fix multi-arch builds: s6-overlay now selects correct architecture (x86_64 for amd64, aarch64 for arm64, arm for arm/v7) - Fix GitHub Actions SBOM generation image reference - Fix GitHub Actions Trivy security scan image reference - Fix resource limits: use Compose v2 syntax instead of swarm-only deploy - Remove obsolete version directive from docker-compose.yml - Remove unnecessary reverse proxy network comments - Document unsupported env vars (MAX_WIKI_ENTRIES_PER_PAGE, MAX_CONTINUOUS_ERRORS) This resolves blocking issues for arm64 builds and CI/CD pipeline.
1 parent f3b0dac commit 2e57298

File tree

3 files changed

+20
-25
lines changed

3 files changed

+20
-25
lines changed

.github/workflows/docker-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ jobs:
8787
if: github.event_name != 'pull_request'
8888
uses: anchore/sbom-action@v0
8989
with:
90-
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
90+
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
9191
format: spdx-json
9292
output-file: sbom.spdx.json
9393

@@ -110,7 +110,7 @@ jobs:
110110
- name: Run Trivy vulnerability scanner
111111
uses: aquasecurity/trivy-action@master
112112
with:
113-
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
113+
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}
114114
format: 'sarif'
115115
output: 'trivy-results.sarif'
116116

Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3636

3737
# Install s6-overlay for proper init and user management
3838
ARG S6_OVERLAY_VERSION=3.1.6.2
39+
ARG TARGETARCH
3940
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
40-
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp
41-
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz && \
42-
tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz && \
41+
RUN case ${TARGETARCH} in \
42+
"amd64") S6_ARCH=x86_64 ;; \
43+
"arm64") S6_ARCH=aarch64 ;; \
44+
"arm/v7") S6_ARCH=arm ;; \
45+
*) echo "Unsupported architecture: ${TARGETARCH}" && exit 1 ;; \
46+
esac && \
47+
curl -L "https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz" -o /tmp/s6-overlay-arch.tar.xz && \
48+
tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz && \
49+
tar -C / -Jxpf /tmp/s6-overlay-arch.tar.xz && \
4350
rm /tmp/s6-overlay-*.tar.xz
4451

4552
# Create default user and group

docker-compose.yml

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
version: '3.8'
2-
31
services:
42
modlog-bot:
53
build: .
@@ -28,8 +26,9 @@ services:
2826
# Advanced settings (optional)
2927
- WIKI_ACTIONS=${WIKI_ACTIONS:-removelink,removecomment,addremovalreason,spamlink,spamcomment,approvelink,approvecomment}
3028
- IGNORED_MODERATORS=${IGNORED_MODERATORS:-}
31-
- MAX_WIKI_ENTRIES_PER_PAGE=${MAX_WIKI_ENTRIES_PER_PAGE:-1000}
32-
- MAX_CONTINUOUS_ERRORS=${MAX_CONTINUOUS_ERRORS:-5}
29+
30+
# Note: MAX_WIKI_ENTRIES_PER_PAGE and MAX_CONTINUOUS_ERRORS require config.json mount
31+
# These settings are not supported via environment variables
3332

3433
volumes:
3534
# Persistent data storage
@@ -45,15 +44,10 @@ services:
4544
max-size: "10m"
4645
max-file: "5"
4746

48-
# Resource limits
49-
deploy:
50-
resources:
51-
limits:
52-
cpus: '0.5'
53-
memory: 256M
54-
reservations:
55-
cpus: '0.1'
56-
memory: 128M
47+
# Resource limits (Compose v2 syntax)
48+
mem_limit: 256m
49+
mem_reservation: 128m
50+
cpus: 0.5
5751

5852
# Optional: Multiple bot instances for different subreddits
5953
# modlog-bot-2:
@@ -67,10 +61,4 @@ services:
6761
# - SOURCE_SUBREDDIT=${SOURCE_SUBREDDIT_2}
6862
# volumes:
6963
# - ./data2:/config/data
70-
# - ./logs2:/config/logs
71-
72-
# Optional: External network for reverse proxy integration
73-
# networks:
74-
# default:
75-
# external:
76-
# name: proxy-network
64+
# - ./logs2:/config/logs

0 commit comments

Comments
 (0)