From 049767f3268a5945049c92c58c99bdb26815ebc7 Mon Sep 17 00:00:00 2001 From: Sceat Date: Thu, 4 Apr 2024 18:59:15 +0300 Subject: [PATCH] ci: publish to docker --- .github/workflows/ci.yml | 22 ++++++++++++++++++---- Dockerfile | 2 -- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2fe77fc..23b9e12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,20 +2,34 @@ name: CI on: push: - branches: - - master + tags: + - v* jobs: push_to_registry: - name: Push Docker image + name: Push Docker image to Docker Hub runs-on: ubuntu-latest steps: - name: Check out the repo uses: actions/checkout@v4 + - name: Log in to Docker Hub + uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 + with: + images: my-docker-hub-namespace/my-docker-hub-repository + - name: Build and push Docker image uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 with: context: . file: ./Dockerfile - push: false + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index afaa062..8508889 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,6 @@ FROM node:21-alpine WORKDIR /app -RUN apk add cmake python3 make curl g++ - COPY package.json package-lock.json ./ RUN npm ci