From 1caa543e35264fb51229049de53229934d45c9c3 Mon Sep 17 00:00:00 2001 From: Rudo Kemper Date: Wed, 8 Oct 2025 15:58:31 -0400 Subject: [PATCH 1/3] Fix dockerfile and CI script --- .github/workflows/docker-publish.yml | 71 ++++++++++------------------ Dockerfile | 7 +++ 2 files changed, 32 insertions(+), 46 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 083b12b..50daa89 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -2,22 +2,31 @@ name: Publish to DockerHub on: push: - branches: - - 'main' + branches: [ main ] pull_request: - branches: - - 'main' + branches: [ main ] release: - types: [created] + types: [ created ] jobs: docker: runs-on: ubuntu-latest + steps: - - name: Checkout + - name: Checkout code uses: actions/checkout@v4 + + - name: Set up Node + uses: actions/setup-node@v4 with: - repository: ConservationMetrics/map-packer + node-version: 20 + cache: 'pnpm' + + - name: Install build dependencies + run: | + sudo apt-get update + sudo apt-get install -y python3 make g++ + - name: Install dependencies and run tests run: | npm install -g pnpm @@ -27,20 +36,22 @@ jobs: else echo "No test directory found, skipping tests." fi - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Login to Docker Hub + + - name: Log in to DockerHub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker + + - name: Extract Docker metadata id: meta uses: docker/metadata-action@v5 with: images: communityfirst/map-packer + - name: Build and push Docker image uses: docker/build-push-action@v5 with: @@ -50,9 +61,10 @@ jobs: push: true tags: | ${{ steps.meta.outputs.tags }} - ${{ github.ref == 'refs/heads/main' && 'communityfirst/map-packer:latest' || '' }} + communityfirst/map-packer:latest labels: ${{ steps.meta.outputs.labels }} - - name: Docker Hub Description + + - name: Update DockerHub description if: github.event_name == 'release' uses: peter-evans/dockerhub-description@v4 with: @@ -60,36 +72,3 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} repository: communityfirst/map-packer short-description: 'A Nuxt app to allow users to generate and manage offline map requests.' - # - name: Test run of Docker image - # run: | - # docker run --rm \ - # -e NUXT_PUBLIC_API_KEY= \ - # -e NUXT_DATABASE=your_db_location \ - # -e NUXT_DB_HOST=localhost \ - # -e NUXT_DB_USER=your_db_user \ - # -e NUXT_DB_PASSWORD=your_db_password \ - # -e NUXT_DB_PORT=5432 \ - # -e NUXT_DB_SSL=true \ - # -e NUXT_DB_TABLE=offline_maps \ - # -e NUXT_AUTH_STRATEGY=auth0 \ - # -e NUXT_OAUTH_AUTH0_DOMAIN="domain.us.auth0.com \ - # -e NUXT_OAUTH_AUTH0_CLIENT_ID= \ - # -e NUXT_OAUTH_AUTH0_CLIENT_SECRET= \ - # -e NUXT_PUBLIC_BASE_URL=http://localhost:8080 \ - # -e NUXT_SESSION_SECRET=your_super_long_secret_for_session_encryption \ - # -e NUXT_PUBLIC_MAPBOX_ACCESS_TOKEN=your_mapbox_token \ - # -e NUXT_PUBLIC_MAP_ZOOM=9 \ - # -e NUXT_PUBLIC_MAP_LATITUDE=40.7128 \ - # -e NUXT_PUBLIC_MAP_LONGITUDE=-74.0060 \ - # -e NUXT_PUBLIC_MAPBOX_STYLE=mapbox://styles/mapbox/streets-v12 \ - # -e NUXT_PUBLIC_MAPBOX_STYLE_NAME="Satellite Streets" \ - # -e NUXT_PUBLIC_PLANET_API_KEY=your_planet_api_key \ - # -e NUXT_PUBLIC_STADIA_API_KEY=your_stadia_api_key \ - # -e NUXT_PUBLIC_THUNDERFOREST_API_KEY=your_thunderforest_api_key \ - # -e NUXT_ASQ_QUEUE_NAME=mappacker-requests \ - # -e NUXT_AZURE_STORAGE_CONNECTION_ACCOUNT_NAME= \ - # -e NUXT_AZURE_STORAGE_CONNECTION_STORAGE_KEY= \ - # -e NUXT_PUBLIC_OFFLINE_MAPS_URI=https://your-offline-maps-uri.com/api/public/dl/your-offline-maps-folder \ - # -e NUXT_PUBLIC_OFFLINE_MAPS_PATH=/offline-maps \ - # -e NUXT_PORT="8080" \ - # ${{ steps.meta.outputs.tags }} diff --git a/Dockerfile b/Dockerfile index 4047029..6b4342f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,13 @@ FROM node:20.15.0-slim RUN mkdir -p /app WORKDIR /app +# Install system dependencies for building native modules +RUN apt-get update && apt-get install -y \ + python3 \ + make \ + g++ \ + && rm -rf /var/lib/apt/lists/* + # Install pnpm RUN npm install -g pnpm From 0bbc91796d2bbcddbfbc6c9554b35b6bfd189baf Mon Sep 17 00:00:00 2001 From: Rudo Kemper Date: Wed, 8 Oct 2025 16:01:59 -0400 Subject: [PATCH 2/3] Set up pnpm properly --- .github/workflows/docker-publish.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 50daa89..7876c38 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -20,7 +20,12 @@ jobs: uses: actions/setup-node@v4 with: node-version: 20 - cache: 'pnpm' + + - name: Set up pnpm + uses: pnpm/action-setup@v3 + with: + version: 9 + run_install: false - name: Install build dependencies run: | @@ -29,7 +34,6 @@ jobs: - name: Install dependencies and run tests run: | - npm install -g pnpm pnpm install if [ -d "test" ]; then pnpm run test From 07d28aad6b49c7e1e3b57401b4121f8ea62503ad Mon Sep 17 00:00:00 2001 From: Rudo Kemper Date: Wed, 8 Oct 2025 16:07:42 -0400 Subject: [PATCH 3/3] resolve native binding issue --- Dockerfile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6b4342f..c710a5f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,16 +10,22 @@ RUN apt-get update && apt-get install -y \ python3 \ make \ g++ \ + git \ + libc-dev \ + libssl-dev \ && rm -rf /var/lib/apt/lists/* # Install pnpm RUN npm install -g pnpm -# Copy package.json and package-lock.json into the container -COPY package*.json /app/ +# Copy package.json and pnpm-lock.yaml into the container +COPY package*.json pnpm-lock.yaml* /app/ -# Install dependencies -RUN pnpm install +# Install dependencies (with rebuild fallback for native modules) +RUN pnpm install --frozen-lockfile || pnpm rebuild + +# Explicitly rebuild oxc-transform to fix native binding issue +RUN pnpm rebuild oxc-transform || true # Copy the application files into the container COPY . /app