Skip to content

Commit a95c50c

Browse files
authored
feat: add GitHub Actions workflow for building and publishing Docker images (#29)
1 parent eaa5553 commit a95c50c

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Build and publish Docker
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
tags:
8+
- 'v*'
9+
workflow_dispatch:
10+
inputs:
11+
dry-run:
12+
description: 'Skip pushing built images'
13+
type: boolean
14+
default: true
15+
env:
16+
IMAGE_NAME: linode/apl-nodejs-helloworld
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v6
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@v3
27+
28+
- name: Log in to Docker registry
29+
uses: docker/login-action@v3
30+
with:
31+
username: ${{ vars.DOCKER_USERNAME }}
32+
password: ${{ secrets.DOCKER_PASSWORD }}
33+
34+
- name: CI tests, image build and push tag for main or branch
35+
uses: docker/build-push-action@v6
36+
with:
37+
push: ${{ github.event_name == 'push' || !github.event.inputs.dry-run }}
38+
context: .
39+
tags: |
40+
${{ env.IMAGE_NAME }}:${{ github.ref_name }}

0 commit comments

Comments
 (0)