Skip to content

Commit

Permalink
Merge pull request #350 from Lodestone-Team/315-dashboard-docker-image
Browse files Browse the repository at this point in the history
Add docker image for dashboard
  • Loading branch information
pinnouse authored Nov 4, 2023
2 parents 5939aaf + 3324036 commit ebb0715
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 3 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/dashboard-release-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Dashboard - Release Docker

on:
release:
types: [published]
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: "${{ github.repository }}-dashboard"

jobs:
dashboard-release-docker:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./dashboard

steps:
- name: checkout repository
uses: actions/checkout@v3
- name: set up QEMU
uses: docker/setup-qemu-action@v2
- name: set up docker buildx
uses: docker/setup-buildx-action@v2
- name: log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: string_tag
uses: ASzc/change-string-case-action@v5
with:
string: ${{ env.REGISTRY}}/${{ env.IMAGE_NAME }}

# https://stackoverflow.com/questions/73402042/github-action-expressions-split-string
- name: set version string
env:
VERSION: ${{ steps.release_asset.outputs.version }}
id: substring
run: echo "version=${VERSION:1}" >> $GITHUB_OUTPUT

- name: set docker version label
env:
LABEL: ${{ !github.event.release.prerelease && 'latest-stable' || 'latest-beta' }}
id: release_type
run: echo "label=${LABEL}" >> $GITHUB_OUTPUT

- name: build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
file: ./Dockerfile
build-args: |
lodestone_version=${{ steps.release_asset.outputs.version }}
push: true
tags: |
${{ steps.string_tag.outputs.lowercase }}:latest
${{ steps.string_tag.outputs.lowercase }}:${{ steps.release_type.outputs.label }}
${{ steps.string_tag.outputs.lowercase }}:${{ steps.substring.outputs.version }}
7 changes: 7 additions & 0 deletions dashboard/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Dockerfile
.dockerignore
node_modules
npm-debug.log
README.md
.next
.git
9 changes: 6 additions & 3 deletions dashboard/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
FROM node as build
FROM node:21 as build

WORKDIR /app

COPY . ./
ENV NODE_ENV production

COPY package*.json /app/
RUN npm ci --legacy-peer-deps

RUN npm install
COPY . ./
RUN npm run build

FROM nginx
Expand Down

0 comments on commit ebb0715

Please sign in to comment.