Skip to content

Commit

Permalink
Add logic to publish a docker to ghcr (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
phyzical authored Dec 6, 2024
1 parent 4cc2880 commit 2e4d9f5
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Simple workflow for deploying static content to GitHub Pages
name: Build docker container

on:
push:
branches: ['main']
workflow_dispatch:

permissions:
contents: read
id-token: write
packages: write

concurrency:
group: 'docker'
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}:latest
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ghcr.io/${{ github.repository }}:latest
platforms: linux/amd64
labels: |
${{ steps.meta.outputs.labels }}
22 changes: 22 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM node:lts-alpine

# install simple http server for serving static content
RUN npm install -g http-server

# make the 'app' folder the current working directory
WORKDIR /app

# copy both 'package.json' and 'package-lock.json' (if available)
COPY package*.json ./

# install project dependencies
RUN npm install

# copy project files and folders to the current working directory (i.e. 'app' folder)
COPY . .

# build app for production with minification
RUN npm run build

EXPOSE 8080
CMD [ "http-server", "dist" ]

0 comments on commit 2e4d9f5

Please sign in to comment.