From 0b2190836dcb37b3aa632e3c2e7e72ec327d3018 Mon Sep 17 00:00:00 2001 From: Fred Clausen <43556888+fredclausen@users.noreply.github.com> Date: Mon, 13 May 2024 16:45:45 -0600 Subject: [PATCH] more updates --- .github/workflows/deploy.yml | 25 ++++++------------------- .gitignore | 1 + Dockerfile | 9 ++++++--- package.json | 3 ++- src/ignored.ts | 1 + src/index.ts | 17 ++++++++++++++--- 6 files changed, 30 insertions(+), 26 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f847421..df897ba 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -7,11 +7,6 @@ on: reason: required: true description: "Reason for running this workflow" - use_test_image: - required: false - type: boolean - description: "Use base image testpr" - default: false push: branches: - main @@ -25,8 +20,6 @@ on: # - REPO: repo name on dockerhub # - IMAGE: image name on dockerhub env: - DOCKERHUB_REPO: mikenye - DOCKERHUB_IMAGE: fr24feed GHCR_IMAGE: ${{ github.repository }} GHCR_REGISTRY: ghcr.io @@ -43,10 +36,8 @@ jobs: - name: Log dispatch reason env: INPUTS_REASON: ${{ github.event.inputs.reason }} - INPUTS_USE_TEST_IMAGE: ${{ github.event.inputs.use_test_image }} run: | echo "Workflow dispatch reason: $INPUTS_REASON" - echo "Use test image: $INPUTS_USE_TEST_IMAGE" hadolint: name: Run hadolint against docker files @@ -64,9 +55,7 @@ jobs: needs: [hadolint] with: push_enabled: true - push_destinations: ghcr.io;dockerhub - dockerhub_profile: mikenye #legacy - dockerhub_repo: docker-flightradar24 #legacy + push_destinations: ghcr.io ghcr_repo_owner: ${{ github.repository_owner }} ghcr_repo: ${{ github.repository }} platform_linux_arm32v6_enabled: false @@ -74,13 +63,11 @@ jobs: platform_linux_i386_enabled: false get_version_method: file_in_container:file=/CONTAINER_VERSION # set build_latest to true if github.event.inputs.use_test_image is false - build_latest: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }} - build_baseimage_test: ${{ github.event.inputs.use_test_image == 'true' }} + build_latest: true + build_baseimage_test: false # only build the entire stack if we are not using the test image - build_version_specific: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }} - build_platform_specific: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }} - build_nohealthcheck: ${{ github.event.inputs.use_test_image == 'false' || github.event.inputs.use_test_image == '' }} - build_baseimage_url: :qemu/:qemu-test-pr + build_version_specific: false + build_platform_specific: false + build_nohealthcheck: false secrets: ghcr_token: ${{ secrets.GITHUB_TOKEN }} - dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index e1050f4..134186a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ prisma/migrations/migration_lock.toml prisma/test.db *-journal dist +.DS_Store diff --git a/Dockerfile b/Dockerfile index d3973e2..e0d0b73 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:22-bookworm-slim +FROM node:22.1.0-bookworm-slim RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app @@ -19,5 +19,8 @@ RUN npm install && \ rm -rf src ENV NODE_ENV=production \ - PORT=3000 -CMD [ "npm", "run", "start"] + PORT=3000 \ + API_KEY="/opt/api/sdre-e-updater.2024-02-05.private-key.pem" \ + APP_ID="818428" \ + DATABASE_URL="file:/opt/api/imageapi.db" +CMD [ "npm", "run", "start_docker"] diff --git a/package.json b/package.json index 0ce552a..cf5a395 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,8 @@ "type": "module", "scripts": { "build": "tsc && tsc-alias", - "start": "npx prisma migrate deploy && node dist/index.js" + "start": "npx prisma migrate deploy && node --env-file='.env' dist/index.js", + "start_docker": "npx prisma migrate deploy && node dist/index.js" }, "author": "Fred Clausen", "license": "MIT", diff --git a/src/ignored.ts b/src/ignored.ts index 2d7e54e..0b213b8 100644 --- a/src/ignored.ts +++ b/src/ignored.ts @@ -24,4 +24,5 @@ export const IGNORED_REPOS = [ "docker-jaero", "rbfeeder", "acars-guide", + "multifeeder", ]; diff --git a/src/index.ts b/src/index.ts index 7e724d9..c645096 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,8 +15,19 @@ const app = express(); const port = process.env.PORT || 3000; const prisma = new PrismaClient(); -let APP_ID = process.env.APP_ID || process.exit(1); -let API_KEY = process.env.API_KEY || process.exit(1); +let APP_ID = process.env.APP_ID; + +if (APP_ID === undefined) { + console.error("APP_ID not set. Exiting"); + process.exit(1); +} + +let API_KEY = process.env.API_KEY; + +if (API_KEY === undefined) { + console.error("API_KEY not set. Exiting"); + process.exit(1); +} const octo_app = new App({ appId: APP_ID, @@ -405,7 +416,7 @@ async function update_images() { let modified_date = new Date(); // FIXME: we should get the modified date from the API let created_date = new Date(); let release_notes = "No release notes available"; - let stable = false; + let stable = true; // lets see if we already have this image in the database let existing_image = false;