From abcf1d7ff506b64366a5542a6471445ad5f0802b Mon Sep 17 00:00:00 2001 From: Alie Date: Fri, 12 Jan 2024 17:21:28 +0100 Subject: [PATCH 01/17] made build branch --- .gitea/workflows/build.yaml | 58 +++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .gitea/workflows/build.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..c645f4f --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,58 @@ +name: Build image +on: + push: + branches: + - main + - build + +jobs: + build: + container: + image: docker:dind + volumes: + - /data/.cache/act:/data/.cache/act + - /var/lib/docker/image:/var/lib/docker/image + - /var/lib/docker/overlay2:/var/lib/docker/overlay2 + steps: + - name: Starting docker daemon + run: docker-init -- dockerd --host=unix:///var/run/docker.sock & + - name: Installing necessary packages + run: apk add nodejs git curl bash + - name: Checkout + uses: actions/checkout@v3 + - name: Docker meta + id: meta + uses: https://github.com/docker/metadata-action@v4 + with: + # list of Docker images to use as base name for tags + images: | + fedi-image-bot/bot-api + git.fai.st/fedi-image-bot/bot-api + # generate Docker tags based on the following events/attributes + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=sha + - name: Set up QEMU + # Add support for more platforms with QEMU (optional) + # https://github.com/docker/setup-qemu-action + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to fai.st docker registry + uses: docker/login-action@v2 + with: + registry: git.fai.st + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_PASS }} + - name: Build and push + uses: docker/build-push-action@v4 + with: + platforms: linux/amd64,linux/arm64 + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=fedi-image-bot/bot-api:latest + cache-to: type=inline \ No newline at end of file -- 2.39.2 From e56e5e54e160ec18fbc4a480b7fec4952b806d22 Mon Sep 17 00:00:00 2001 From: Alie Date: Fri, 12 Jan 2024 17:21:28 +0100 Subject: [PATCH 02/17] changed name for ordering --- .gitea/workflows/{test.yaml => 01_test.yaml} | 0 .gitea/workflows/{build.yaml => 02_build.yaml} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename .gitea/workflows/{test.yaml => 01_test.yaml} (100%) rename .gitea/workflows/{build.yaml => 02_build.yaml} (100%) diff --git a/.gitea/workflows/test.yaml b/.gitea/workflows/01_test.yaml similarity index 100% rename from .gitea/workflows/test.yaml rename to .gitea/workflows/01_test.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/02_build.yaml similarity index 100% rename from .gitea/workflows/build.yaml rename to .gitea/workflows/02_build.yaml -- 2.39.2 From a1e8a3314c9b95bac1f5fd9ed4b987a32b46bc4f Mon Sep 17 00:00:00 2001 From: Alie Date: Fri, 12 Jan 2024 17:21:28 +0100 Subject: [PATCH 03/17] awawawa --- .gitea/workflows/01_test.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/01_test.yaml b/.gitea/workflows/01_test.yaml index cc76118..f92a022 100644 --- a/.gitea/workflows/01_test.yaml +++ b/.gitea/workflows/01_test.yaml @@ -1,10 +1,11 @@ name: Unit Tests with docker compose on: - pull_request: push: branches: - main - develop + - build + pull_request: jobs: unit-test: -- 2.39.2 From 8f27b08f30df5171d986f12d549df815861ab960 Mon Sep 17 00:00:00 2001 From: Alie Date: Sun, 14 Jan 2024 13:02:51 +0100 Subject: [PATCH 04/17] diable qemu while action instance does not support it --- .gitea/workflows/01_test.yaml | 8 +------- .gitea/workflows/02_build.yaml | 4 ++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/01_test.yaml b/.gitea/workflows/01_test.yaml index f92a022..bc53a23 100644 --- a/.gitea/workflows/01_test.yaml +++ b/.gitea/workflows/01_test.yaml @@ -1,11 +1,5 @@ name: Unit Tests with docker compose -on: - push: - branches: - - main - - develop - - build - pull_request: +on: [push, pull_request] jobs: unit-test: diff --git a/.gitea/workflows/02_build.yaml b/.gitea/workflows/02_build.yaml index c645f4f..3d9c4c3 100644 --- a/.gitea/workflows/02_build.yaml +++ b/.gitea/workflows/02_build.yaml @@ -34,10 +34,10 @@ jobs: type=ref,event=branch type=ref,event=pr type=sha - - name: Set up QEMU +# - name: Set up QEMU # Add support for more platforms with QEMU (optional) # https://github.com/docker/setup-qemu-action - uses: docker/setup-qemu-action@v2 +# uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to fai.st docker registry -- 2.39.2 From ce99f82642e1bcabc248c8cebcbaaae2ce2533bf Mon Sep 17 00:00:00 2001 From: Alie Date: Sun, 14 Jan 2024 13:16:18 +0100 Subject: [PATCH 05/17] added lock step to dockerfile --- Dockerfile | 11 +++++++--- yarn.lock | 59 +++++++++++++++++++++++++++++------------------------- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/Dockerfile b/Dockerfile index cb090b3..bb2d8bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,14 +5,19 @@ FROM oven/bun:1 as base WORKDIR /usr/src/app +# Generate new bun lock +FROM base as lock +RUN mkdir -p /temp/lock +COPY package.json /temp/lock +RUN cd /temp/lock && bun install + # install dependencies into temp folder # this will cache them and speed up future builds FROM base AS install - # install with --production (exclude devDependencies) RUN mkdir -p /temp/prod -COPY package.json yarn.lock /temp/prod/ -RUN cd /temp/prod && bun install --production +COPY --from=lock /temp/lock/package.json /temp/lock/bun.lockb /temp/prod/ +RUN cd /temp/prod && bun install --production --frozen-lockfile # Copy production dependencies and source code into final image FROM base AS release diff --git a/yarn.lock b/yarn.lock index 3293ba7..84daa2c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1,6 +1,6 @@ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 -# bun ./bun.lockb --hash: 9B0DB2A6DDF32440-fedbc92538df07cc-E7A3C1DB0A83DF66-732fbcf575fe4b52 +# bun ./bun.lockb --hash: 0566846CEF9BC37B-67668f8ef100cf47-BD54633F277319ED-f974ac5408e619f6 "@ampproject/remapping@^2.2.0": @@ -24,7 +24,7 @@ resolved "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz" integrity sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw== -"@babel/core@>=7.0.0-beta.0 <8", "@babel/core@^7.0.0", "@babel/core@^7.0.0-0", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.8.0": +"@babel/core@^7.0.0", "@babel/core@^7.0.0-0", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.8.0": version "7.23.7" resolved "https://registry.npmjs.org/@babel/core/-/core-7.23.7.tgz" integrity sha512-+UpDgowcmqe36d4NwqvKsyPMlOLNGMsfMmQ5WGCu+siCe3t3dfe9njrzGfdN4qq+bcNUt0+Vw6haRxBOycs4dw== @@ -139,9 +139,9 @@ integrity sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw== "@babel/helpers@^7.23.7": - version "7.23.7" - resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.7.tgz" - integrity sha512-6AMnjCoC8wjqBzDHkuqpa7jAKwvMo4dC+lr/TFBz+ucfulO1XMpDnwWPGBNwClOKZ8h6xn5N81W/R5OrcKtCbQ== + version "7.23.8" + resolved "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.8.tgz" + integrity sha512-KDqYz4PiOWvDFrdHLPhKtCThtIcKVy6avWD2oG4GEvyQ+XDZwHD4YQd+H2vNMnq2rkdxsDkU82T+Vk8U/WXHRQ== dependencies: "@babel/template" "^7.22.15" "@babel/traverse" "^7.23.7" @@ -550,17 +550,17 @@ integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== "@jridgewell/trace-mapping@^0.3.12", "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.18", "@jridgewell/trace-mapping@^0.3.9": - version "0.3.20" - resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz" - integrity sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q== + version "0.3.21" + resolved "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.21.tgz" + integrity sha512-SRfKmRe1KvYnxjEMtxEr+J4HIeMX5YBg/qhRHpxEIGjhX1rshcHlnFUE9K0GazhVKWM7B+nARSkV8LuvJdJ5/g== dependencies: "@jridgewell/resolve-uri" "^3.1.0" "@jridgewell/sourcemap-codec" "^1.4.14" "@mongodb-js/saslprep@^1.1.0": - version "1.1.1" - resolved "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.1.tgz" - integrity sha512-t7c5K033joZZMspnHg/gWPE4kandgc2OxE74aYOtGKfgB9VPuVJPix0H6fhmm2erj5PBJ21mqcx34lpIGtUCsQ== + version "1.1.3" + resolved "https://registry.npmjs.org/@mongodb-js/saslprep/-/saslprep-1.1.3.tgz" + integrity sha512-SyCxhJfmK6MoLNV5SbDpNdUy9SDv5H7y9/9rl3KpnwgTHWuNNMc87zWqbcIZXNWY+aUjxLGLEcvHoLagG4tWCg== dependencies: sparse-bitfield "^3.0.3" @@ -732,9 +732,9 @@ integrity sha512-iJt33IQnVRkqeqC7PzBHPTC6fDlRNRW8vjrgqtScAhrmMwe8c4Eo7+fUGTa+XdWrpEgpyKWMYmi2dIwMAYRzPw== "@types/node@*": - version "20.10.6" - resolved "https://registry.npmjs.org/@types/node/-/node-20.10.6.tgz" - integrity sha512-Vac8H+NlRNNlAmDfGUP7b5h/KA+AtWIzuXy0E6OyP8f1tCLYAtPvKRRDJjAPqhpCb0t6U2j7/xqAuLEebW2kiw== + version "20.11.0" + resolved "https://registry.npmjs.org/@types/node/-/node-20.11.0.tgz" + integrity sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxAjqx41zp9qlIAVFi0IhCNsJcXolEqLWhbFbEeL0PvYm4pcQ== dependencies: undici-types "~5.26.4" @@ -1036,9 +1036,9 @@ buffer-from@^1.0.0: integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== bun-types@latest: - version "1.0.21" - resolved "https://registry.npmjs.org/bun-types/-/bun-types-1.0.21.tgz" - integrity sha512-Ugagjf+XZUXDvxDRa3EnhLeMzm2g8ZYFleBF55Ac3GZSzPqdMLAdK9kvZB6M1H4nAFvrEHdV2PHqkzIoNs+3wQ== + version "1.0.22" + resolved "https://registry.npmjs.org/bun-types/-/bun-types-1.0.22.tgz" + integrity sha512-JxmXAx6cXb37+rMsn30WRXlz9lbPFR9rQE78hNSoy5wJ8m/nUktkmHpo7xZb/YKDds23ifxWLjDtyni9MeXLgw== dependencies: "@types/node" "*" "@types/ws" "*" @@ -1079,9 +1079,9 @@ camelcase@^6.2.0: integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== caniuse-lite@^1.0.30001565: - version "1.0.30001574" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001574.tgz" - integrity sha512-BtYEK4r/iHt/txm81KBudCUcTy7t+s9emrIaHqjYurQ10x71zJ5VQ9x1dYPcz/b+pKSp4y/v1xSI67A+LzpNyg== + version "1.0.30001576" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001576.tgz" + integrity sha512-ff5BdakGe2P3SQsMsiqmt1Lc8221NR1VzHj5jXN5vBny9A6fpze94HiVV/n7XRosOlsShJcvMv5mdnpjOGCEgg== chalk@^2.4.2: version "2.4.2" @@ -1352,9 +1352,9 @@ ee-first@1.1.1: integrity sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow== electron-to-chromium@^1.4.601: - version "1.4.623" - resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.623.tgz" - integrity sha512-lKoz10iCYlP1WtRYdh5MvocQPWVRoI7ysp6qf18bmeBgR8abE6+I2CsfyNKztRDZvhdWc+krKT6wS7Neg8sw3A== + version "1.4.630" + resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.630.tgz" + integrity sha512-osHqhtjojpCsACVnuD11xO5g9xaCyw7Qqn/C2KParkMv42i8jrJJgx3g7mkHfpxwhy9MnOJr8+pKOdZ7qzgizg== emittery@^0.13.1: version "0.13.1" @@ -2463,9 +2463,9 @@ mongodb-connection-string-url@^2.6.0: whatwg-url "^11.0.0" mongoose@^8.0.3: - version "8.0.3" - resolved "https://registry.npmjs.org/mongoose/-/mongoose-8.0.3.tgz" - integrity sha512-LJRT0yP4TW14HT4r2RkxqyvoTylMSzWpl5QOeVHTnRggCLQSpkoBdgbUtORFq/mSL2o9cLCPJz+6uzFj25qbHw== + version "8.0.4" + resolved "https://registry.npmjs.org/mongoose/-/mongoose-8.0.4.tgz" + integrity sha512-wN9qvdevX3+922VnLT7CpaZRT3jmVCBOK2QMHMGeScQxDRnFMPpkuI9StEPpZo/3x8t+kbzH7F8RMPsyNwyM4w== dependencies: bson "^6.2.0" kareem "2.5.1" @@ -3109,11 +3109,16 @@ type-is@~1.6.18: resolved "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz" integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw== -undici-types@^5.26.4, undici-types@~5.26.4: +undici-types@~5.26.4: version "5.26.5" resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz" integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== +undici-types@^5.26.4: + version "5.28.2" + resolved "https://registry.npmjs.org/undici-types/-/undici-types-5.28.2.tgz" + integrity sha512-W71OLwDqzIO0d3k07qg1xc7d4cX8SsSwuCO4bQ4V7ITwduXXie/lcImofabP5VV+NvuvSe8ovKvHVJcizVc1JA== + unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz" -- 2.39.2 From b337842ef43e251a11cea13a6e19fc03da75a0c1 Mon Sep 17 00:00:00 2001 From: Alie Date: Sun, 14 Jan 2024 13:19:41 +0100 Subject: [PATCH 06/17] wrong source of copy in dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bb2d8bb..9f88307 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ RUN cd /temp/prod && bun install --production --frozen-lockfile FROM base AS release COPY --from=install /temp/prod/node_modules node_modules COPY --from=install /usr/src/app/src ./src -COPY --from=install /usr/src/app/package.json . +COPY --from=install /temp/prod/package.json . # run the app USER bun -- 2.39.2 From bccfcc680a6217e50aa4e7c4d597a99cba43c704 Mon Sep 17 00:00:00 2001 From: Alie Date: Sun, 14 Jan 2024 13:23:36 +0100 Subject: [PATCH 07/17] wrong source from in dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9f88307..bd1678d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,8 +22,8 @@ RUN cd /temp/prod && bun install --production --frozen-lockfile # Copy production dependencies and source code into final image FROM base AS release COPY --from=install /temp/prod/node_modules node_modules -COPY --from=install /usr/src/app/src ./src COPY --from=install /temp/prod/package.json . +COPY ./src ./src # run the app USER bun -- 2.39.2 From 180acb95e6ef0380971c6b0ddf328fbd91afbc63 Mon Sep 17 00:00:00 2001 From: Alie Date: Sun, 14 Jan 2024 13:31:47 +0100 Subject: [PATCH 08/17] erase docker repo from build file --- .gitea/workflows/02_build.yaml | 1 - package.json | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitea/workflows/02_build.yaml b/.gitea/workflows/02_build.yaml index 3d9c4c3..67a77b4 100644 --- a/.gitea/workflows/02_build.yaml +++ b/.gitea/workflows/02_build.yaml @@ -26,7 +26,6 @@ jobs: with: # list of Docker images to use as base name for tags images: | - fedi-image-bot/bot-api git.fai.st/fedi-image-bot/bot-api # generate Docker tags based on the following events/attributes tags: | diff --git a/package.json b/package.json index 51ef3eb..e36feb8 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "enforce-unique": "^1.2.0", "jest": "^29.7.0", "supertest": "^6.3.3", + "@types/compression": "^1.7.5", "ts-jest": "^29.1.1" }, "peerDependencies": { @@ -25,7 +26,6 @@ "test": "docker compose down -v && docker compose run bot-api bun test" }, "dependencies": { - "@types/compression": "^1.7.5", "compression": "^1.7.4", "express": "^4.18.2", "express-list-endpoints": "^6.0.0", -- 2.39.2 From ae4a47f0d416989a5fd2f2d02a2516178c7f0b34 Mon Sep 17 00:00:00 2001 From: Alie Date: Sun, 14 Jan 2024 13:41:39 +0100 Subject: [PATCH 09/17] cleanup of build file, added latest tag for main --- .gitea/workflows/02_build.yaml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.gitea/workflows/02_build.yaml b/.gitea/workflows/02_build.yaml index 67a77b4..c4646d2 100644 --- a/.gitea/workflows/02_build.yaml +++ b/.gitea/workflows/02_build.yaml @@ -29,14 +29,9 @@ jobs: git.fai.st/fedi-image-bot/bot-api # generate Docker tags based on the following events/attributes tags: | - type=schedule + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} type=ref,event=branch - type=ref,event=pr type=sha -# - name: Set up QEMU - # Add support for more platforms with QEMU (optional) - # https://github.com/docker/setup-qemu-action -# uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to fai.st docker registry -- 2.39.2 From ca4449c1067440d543f31031805b94acf7a0c88f Mon Sep 17 00:00:00 2001 From: Alie Date: Sun, 14 Jan 2024 13:50:08 +0100 Subject: [PATCH 10/17] added cache ref to build action --- .gitea/workflows/02_build.yaml | 3 +-- .gitignore | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/02_build.yaml b/.gitea/workflows/02_build.yaml index c4646d2..4e8843a 100644 --- a/.gitea/workflows/02_build.yaml +++ b/.gitea/workflows/02_build.yaml @@ -4,7 +4,6 @@ on: branches: - main - build - jobs: build: container: @@ -48,5 +47,5 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=registry,ref=fedi-image-bot/bot-api:latest + cache-from: type=registry,ref=git.fai.st/fedi-image-bot/bot-api:{{branch}} cache-to: type=inline \ No newline at end of file diff --git a/.gitignore b/.gitignore index edd7ad4..f16c346 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,4 @@ bun.lockb .env .editorconfig .idea -coverage* \ No newline at end of file +coverage* -- 2.39.2 From f5750fa671a9b558fa2ffee50cfd22ef56cdc69f Mon Sep 17 00:00:00 2001 From: Alie Date: Sun, 14 Jan 2024 13:54:43 +0100 Subject: [PATCH 11/17] fprgpr the $ --- .gitea/workflows/02_build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/02_build.yaml b/.gitea/workflows/02_build.yaml index 4e8843a..353ad0f 100644 --- a/.gitea/workflows/02_build.yaml +++ b/.gitea/workflows/02_build.yaml @@ -47,5 +47,5 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=registry,ref=git.fai.st/fedi-image-bot/bot-api:{{branch}} + cache-from: type=registry,ref=git.fai.st/fedi-image-bot/bot-api:${{ branch }} cache-to: type=inline \ No newline at end of file -- 2.39.2 From 2bced1d079fdc355b7d78507cfe8ab05d06ec356 Mon Sep 17 00:00:00 2001 From: Alie Date: Sun, 14 Jan 2024 13:59:19 +0100 Subject: [PATCH 12/17] delete cache since it seems to not do ,much --- .gitea/workflows/02_build.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.gitea/workflows/02_build.yaml b/.gitea/workflows/02_build.yaml index 353ad0f..108e093 100644 --- a/.gitea/workflows/02_build.yaml +++ b/.gitea/workflows/02_build.yaml @@ -47,5 +47,3 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=registry,ref=git.fai.st/fedi-image-bot/bot-api:${{ branch }} - cache-to: type=inline \ No newline at end of file -- 2.39.2 From 470654b5152da4586876dbaf120f04c43b2f1bf5 Mon Sep 17 00:00:00 2001 From: Alie Date: Sun, 14 Jan 2024 14:20:18 +0100 Subject: [PATCH 13/17] error on enviroment var dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index bd1678d..ebd13cb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,6 +27,6 @@ COPY ./src ./src # run the app USER bun -ENV NODE_ENV=production +ENV NODE_ENV production EXPOSE 8080/tcp CMD ["bun", "run", "start"] -- 2.39.2 From a226155e9aa31a616790de892a21a1bda9926a0d Mon Sep 17 00:00:00 2001 From: Alie Date: Sun, 14 Jan 2024 14:30:41 +0100 Subject: [PATCH 14/17] remove test import for dev --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index b431ebd..1fc84e5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,3 @@ -import populateDatabase from "../tests/populateDatabase"; import { startApp } from "./app"; await startApp(); @@ -7,6 +6,7 @@ await startApp(); try { // Not insert test data into production if (process.env.NODE_ENV != "production") { + const populateDatabase = require("../tests/populateDatabase"); await populateDatabase(); } } catch {} -- 2.39.2 From 772bd4a7f610b2229340feb85be042f35d5bdce1 Mon Sep 17 00:00:00 2001 From: Alie Date: Sun, 14 Jan 2024 19:33:44 +0100 Subject: [PATCH 15/17] add git tag support to build --- .gitea/workflows/02_build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/02_build.yaml b/.gitea/workflows/02_build.yaml index 108e093..80817e8 100644 --- a/.gitea/workflows/02_build.yaml +++ b/.gitea/workflows/02_build.yaml @@ -30,6 +30,7 @@ jobs: tags: | type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} type=ref,event=branch + type=semver,pattern={{raw}} type=sha - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 -- 2.39.2 From eff25cc90cb23fe29b03e21712449f44fbdd1211 Mon Sep 17 00:00:00 2001 From: Alie Date: Sun, 14 Jan 2024 19:45:05 +0100 Subject: [PATCH 16/17] add build action to tags --- .gitea/workflows/02_build.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/02_build.yaml b/.gitea/workflows/02_build.yaml index 80817e8..5292d58 100644 --- a/.gitea/workflows/02_build.yaml +++ b/.gitea/workflows/02_build.yaml @@ -4,6 +4,9 @@ on: branches: - main - build + tags: + - v* + jobs: build: container: @@ -31,7 +34,6 @@ jobs: type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} type=ref,event=branch type=semver,pattern={{raw}} - type=sha - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to fai.st docker registry -- 2.39.2 From 803e1f168f707bfb21daa2d4c901db2847749011 Mon Sep 17 00:00:00 2001 From: Alie Date: Sun, 14 Jan 2024 20:44:32 +0100 Subject: [PATCH 17/17] actual change --- .gitea/workflows/02_build.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/02_build.yaml b/.gitea/workflows/02_build.yaml index 108e093..5292d58 100644 --- a/.gitea/workflows/02_build.yaml +++ b/.gitea/workflows/02_build.yaml @@ -4,6 +4,9 @@ on: branches: - main - build + tags: + - v* + jobs: build: container: @@ -30,7 +33,7 @@ jobs: tags: | type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }} type=ref,event=branch - type=sha + type=semver,pattern={{raw}} - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to fai.st docker registry -- 2.39.2