From 62705ef20db3012b342b66eb185c30941040770c Mon Sep 17 00:00:00 2001 From: spiral Date: Tue, 1 Feb 2022 09:12:55 -0500 Subject: [PATCH] add docker build files --- .dockerignore | 1 + .github/workflows/docker.yml | 34 ++++++++++++++++++++++++++++++++++ Dockerfile | 11 +++++++++++ 3 files changed, 46 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/workflows/docker.yml create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..40b878d --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..84e05e0 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,34 @@ +name: Docker build + +on: + push: + branches: [ main ] + +jobs: + image: + name: Build Docker image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Log into registry ${{ env.REGISTRY }} + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v2 + with: + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: | + ghcr.io/apparyllisorg/spot:${{ github.sha }} + ghcr.io/apparyllisorg/spot:latest + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3623ef7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM alpine:latest + +RUN apk add nodejs-current yarn + +WORKDIR /app +COPY package.json yarn.lock /app/ +RUN yarn + +COPY . /app + +CMD ["node", "bot.js"] \ No newline at end of file