From d52e8777e85e93fca20806712d11ea971cb54189 Mon Sep 17 00:00:00 2001 From: ndsboy Date: Mon, 24 Feb 2025 22:44:57 +0000 Subject: [PATCH] feat: create container --- .forgejo/workflows/deploy.yml | 30 ++++++++++++++++++++++++++++++ .vscode/tasks.json | 2 +- Containerfile | 9 +++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 .forgejo/workflows/deploy.yml create mode 100644 Containerfile diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml new file mode 100644 index 0000000..ee37452 --- /dev/null +++ b/.forgejo/workflows/deploy.yml @@ -0,0 +1,30 @@ +name: deploy +on: [push, workflow_dispatch] + +env: + repo: directus + git: git.swablab.de + url: git.swablab.de/${{ github.repository }} + token: ${{ secrets.SWABLAB_ORGA_PACKAGE_TOKEN }} + +jobs: + deploy: + name: deploy + runs-on: docker + if: github.ref == 'refs/heads/main' + container: + image: quay.io/buildah/stable:latest + env: + STORAGE_DRIVER: vfs + steps: + - name: download + run: curl https://${{ env.url }}/archive/main.tar.gz | tar -xz + + - name: build + run: buildah build -f ${{ env.repo }}/Containerfile -t ${{ env.url }}:latest ${{ env.repo }} + + - name: login + run: buildah login -u token -p ${{ env.token }} ${{ env.git }} + + - name: push + run: buildah push ${{ env.git }}/${{ github.repository }}:latest diff --git a/.vscode/tasks.json b/.vscode/tasks.json index ace5795..b68d9ab 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -3,7 +3,7 @@ "tasks": [ { "label": "install", - "command": "npm i", + "command": "npm install", "type": "shell", "problemMatcher": [] }, diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..c88b1c5 --- /dev/null +++ b/Containerfile @@ -0,0 +1,9 @@ +FROM docker.io/library/node AS build +COPY . . +RUN npm install +RUN npm run build + +FROM docker.io/directus/directus +RUN mkdir /directus/extensions/directus-extension-swablab +COPY --from=build ./package.json /directus/extensions/directus-extension-swablab/package.json +COPY --from=build ./dist /directus/extensions/directus-extension-swablab/dist \ No newline at end of file