Skip to content

Commit

Permalink
Add Docker Hub action
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Oct 19, 2023
1 parent f4a2c84 commit 4f6e988
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 3 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/docker-hub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish Docker image

on:
push:
branches:
- main
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: graphile/worker
flavor: |
latest=${{ github.ref == 'refs/heads/main' }}
tags: |
type=raw,value=next
type=semver,pattern={{version}}
type=semver,pattern={{major}}-{{minor}}
type=semver,pattern={{major}}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64/v8
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14-alpine as builder
FROM node:18-alpine as builder

WORKDIR /worker/

Expand All @@ -12,15 +12,15 @@ COPY ./src ./src

RUN yarn run prepack

FROM node:14-alpine as clean
FROM node:18-alpine as clean

COPY package.json yarn.lock /worker/

COPY *.md /worker/
COPY --from=builder /worker/dist/ /worker/dist/
COPY --from=builder /worker/sql/ /worker/sql/

FROM node:14-alpine
FROM node:18-alpine
LABEL description="High performance Node.js/PostgreSQL job queue "

WORKDIR /worker/
Expand Down

0 comments on commit 4f6e988

Please sign in to comment.