From b8b71481c69c0afa21abc00028f548c4f7b46902 Mon Sep 17 00:00:00 2001 From: Jakub Filo Date: Wed, 7 Jun 2023 07:30:36 +0000 Subject: [PATCH] Add Docker builds --- .dockerignore | 2 ++ .gitea/workflows/docker-publish.yaml | 44 ++++++++++++++++++++++++++++ Dockerfile | 9 ++++++ 3 files changed, 55 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitea/workflows/docker-publish.yaml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..93f1361 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +node_modules +npm-debug.log diff --git a/.gitea/workflows/docker-publish.yaml b/.gitea/workflows/docker-publish.yaml new file mode 100644 index 0000000..61b7f4a --- /dev/null +++ b/.gitea/workflows/docker-publish.yaml @@ -0,0 +1,44 @@ +name: Build & publish images + +on: [push] + +env: + REGISTRY: git.plantroon.com + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push-image: + runs-on: ubuntu-latest + container: + image: catthehacker/ubuntu:act-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.CR_PAT }} + + - name: Extract Docker metadata + id: meta + uses: https://github.com/docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: git.plantroon.com/aux/keyserver + + - name: Build and push Docker image + id: build-and-push + uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a + with: + context: . + push: true + labels: ${{ steps.meta.outputs.labels }} + tags: ${{ steps.meta.outputs.tags }} + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b944ac5 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM node:16 + +WORKDIR /app +COPY package*.json ./ +RUN npm ci --omit=dev +COPY . . +EXPOSE 3000 + +CMD [ "node", "index.js" ]