Skip to content

Publish to ghcr.io #9

Publish to ghcr.io

Publish to ghcr.io #9

Workflow file for this run

name: Publish to ghcr.io
env:
IMAGE_NAME: dockge
on:
release:
types: [released]
workflow_dispatch:
jobs:
build-and-publish-image:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 22
- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Lint
run: pnpm run lint
- name: Check Typescript
run: pnpm run check-ts
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: 18 # Specify the Node.js version required for env2arg.js
- name: Log in to GitHub Container Registry
uses: docker/#-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GITHUB_ACTOR }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push base Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
file: ./docker/Base.Dockerfile
push: true
tags: ghcr.io/tobi1449/dockge:base
- name: Build and publish health-check Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
file: ./docker/BuildHealthCheck.Dockerfile
push: true
tags: ghcr.io/tobi1449/dockge:build-healthcheck
- name: Build and publish main Docker Image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
file: ./docker/Dockerfile
push: true
# Substitute the values from env2arg.js into the Docker command
tags: |
ghcr.io/tobi1449/dockge:latest
ghcr.io/tobi1449/dockge:$VERSION
target: release