From 293c824549fe3f611da53b0684b3294c333cd02a Mon Sep 17 00:00:00 2001 From: Timothy Trovatelli Date: Thu, 29 May 2025 17:20:11 +0200 Subject: [PATCH 1/6] qemu for arm emulation --- .github/workflows/release.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 853da4e..4392927 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -45,6 +45,11 @@ jobs: type=raw,value=latest,enable={{is_default_branch}} type=raw,value=${{ github.event.inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' }} + - name: Set up QEMU + # Add support for more platforms with QEMU (optional) + # https://github.com/docker/setup-qemu-action + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From 3d802c2c1b6f3350d5c7d1175cd060dbec80ef96 Mon Sep 17 00:00:00 2001 From: Timothy Trovatelli Date: Thu, 29 May 2025 17:36:11 +0200 Subject: [PATCH 2/6] remove arm7 to debug pipeline --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4392927..7c0080f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,4 +63,4 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - platforms: linux/amd64,linux/arm64,linux/arm/v7 \ No newline at end of file + platforms: linux/amd64,linux/arm64 #,linux/arm/v7 \ No newline at end of file From 7e7ff9ba23de60a33b3ca4c3cf94750a25e81b24 Mon Sep 17 00:00:00 2001 From: Timothy Trovatelli Date: Thu, 29 May 2025 17:54:14 +0200 Subject: [PATCH 3/6] change node version --- deployment/prod/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deployment/prod/Dockerfile b/deployment/prod/Dockerfile index 497a20e..ab24b1d 100644 --- a/deployment/prod/Dockerfile +++ b/deployment/prod/Dockerfile @@ -1,5 +1,5 @@ # Stage 1: Build the SvelteKit application and scheduler -FROM node:22-alpine AS builder +FROM node:22-bullseye-slim AS builder WORKDIR /app From a7fde1aa9d91f8890eea2d7e987688706a7a8438 Mon Sep 17 00:00:00 2001 From: Timothy Trovatelli Date: Thu, 29 May 2025 18:04:29 +0200 Subject: [PATCH 4/6] readd armv7 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7c0080f..4392927 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,4 +63,4 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max - platforms: linux/amd64,linux/arm64 #,linux/arm/v7 \ No newline at end of file + platforms: linux/amd64,linux/arm64,linux/arm/v7 \ No newline at end of file From 7388e4bbe1038075245da8658fdc07e1e4ec3af6 Mon Sep 17 00:00:00 2001 From: Timothy Trovatelli Date: Thu, 29 May 2025 18:15:44 +0200 Subject: [PATCH 5/6] trying to build in a separate platform --- deployment/prod/Dockerfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/deployment/prod/Dockerfile b/deployment/prod/Dockerfile index ab24b1d..7e3322e 100644 --- a/deployment/prod/Dockerfile +++ b/deployment/prod/Dockerfile @@ -1,5 +1,5 @@ # Stage 1: Build the SvelteKit application and scheduler -FROM node:22-bullseye-slim AS builder +FROM --platform=linux/amd64 node:22-bullseye-slim AS builder WORKDIR /app @@ -29,8 +29,7 @@ WORKDIR /app/packages/scheduler RUN npm run build # Stage 2: Production environment -FROM node:22-alpine - +FROM --platform=$TARGETPLATFORM node:22-bullseye-slim # Create a non-root user and group RUN addgroup -g 1001 -S nodejs && \ adduser -S app -u 1001 -G nodejs From 4152dd56ce4461ac9d8f40980b931f46d6160775 Mon Sep 17 00:00:00 2001 From: Timothy Trovatelli Date: Thu, 29 May 2025 18:16:31 +0200 Subject: [PATCH 6/6] update --- deployment/prod/Dockerfile | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/deployment/prod/Dockerfile b/deployment/prod/Dockerfile index 7e3322e..8b87e1c 100644 --- a/deployment/prod/Dockerfile +++ b/deployment/prod/Dockerfile @@ -30,9 +30,10 @@ RUN npm run build # Stage 2: Production environment FROM --platform=$TARGETPLATFORM node:22-bullseye-slim -# Create a non-root user and group -RUN addgroup -g 1001 -S nodejs && \ - adduser -S app -u 1001 -G nodejs + +# Create a non-root user and group (Debian syntax) +RUN groupadd -g 1001 nodejs && \ + useradd -r -u 1001 -g nodejs app WORKDIR /app @@ -43,24 +44,16 @@ COPY packages/simply-tweeted-app/package.json ./packages/simply-tweeted-app/ COPY packages/shared-lib/package.json ./packages/shared-lib/ COPY packages/scheduler/package.json ./packages/scheduler/ -# Install concurrently for running multiple services -RUN npm install concurrently - # Copy built shared-lib from builder stage COPY --from=builder /app/packages/shared-lib/dist ./packages/shared-lib/dist +COPY --from=builder /app/packages/shared-lib/package.json ./packages/shared-lib/ # Copy built app from builder stage COPY --from=builder /app/packages/simply-tweeted-app/build ./packages/simply-tweeted-app/build # Copy built scheduler from builder stage COPY --from=builder /app/packages/scheduler/dist ./packages/scheduler/dist -# Copy scheduler source files (needed for any runtime dependencies) -COPY packages/scheduler/src ./packages/scheduler/src - -# Install production dependencies only -RUN npm ci --omit=dev - -# Install concurrently globally for easier access -RUN npm install -g concurrently +# Install production dependencies and concurrently +RUN npm ci --omit=dev && npm install -g concurrently # Change ownership of the app directory to the non-root user RUN chown -R app:nodejs /app @@ -71,16 +64,8 @@ USER app # Expose the port the app will run on EXPOSE 3000 -# Environment variables will be passed at runtime -# ENV AUTH_SECRET=your_auth_secret_value -# ENV DB_ENCRYPTION_KEY=your_db_encryption_key_value -# ENV AUTH_TWITTER_ID=your_auth_twitter_id_value -# ENV AUTH_TWITTER_SECRET=your_auth_twitter_secret_value -# ENV ALLOWED_TWITTER_ACCOUNTS=your_allowed_twitter_accounts_value -# ENV MONGODB_URI=your_mongodb_uri_value - ENV NODE_ENV=production ENV AUTH_TRUST_HOST=true # Run both the frontend and scheduler using concurrently -CMD ["concurrently", "--names", "FRONTEND,SCHEDULER", "--prefix-colors", "blue,green", "cd packages/simply-tweeted-app && node build/index.js", "cd packages/scheduler && node dist/index.js"] \ No newline at end of file +CMD ["concurrently", "--names", "FRONTEND,SCHEDULER", "--prefix-colors", "blue,green", "node packages/simply-tweeted-app/build/index.js", "node packages/scheduler/dist/index.js"] \ No newline at end of file