Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add Docker image build on prod release and publish to ghcr.io #501

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/prodtag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,20 @@ jobs:
files: |
phanpy-dist.zip
phanpy-dist.tar.gz
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
${{ steps.tag_name.outputs.tag_name }}
latest
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args: |
VERSION=${{ steps.tag_name.outputs.tag_name }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
16 changes: 16 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from node:21-alpine as builder

workdir /code

copy . /code

run npm ci && npm run build

from nginx:1.25.4-alpine

label maintainer="Victoria Nadasdi <[email protected]>"
label org.opencontainers.image.source=https://github.com/cheeaun/phanpy
label org.opencontainers.image.description="Docker Image for Phanpy"
label org.opencontainers.image.licenses=MIT

copy --from=builder /code/dist /usr/share/nginx/html
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,31 @@ Some of these may change in the future. The front-end world is ever-changing.

This is a **pure static web app**. You can host it anywhere you want.

Two ways (choose one):
Three ways (choose one):

### Easy way

Go to [Releases](https://github.com/cheeaun/phanpy/releases) and download the latest `phanpy-dist.zip` or `phanpy-dist.tar.gz`. It's pre-built so don't need to run any install/build commands. Extract it. Serve the folder of extracted files.

### The Docker way

```bash
docker run -p 8080:80 ghcr.io/cheeaun/phanpy:latest
```

With Docker Compose:

```yaml
---
version: "3.9"
services:
phanpy:
image: ghcr.io/cheeaun/phanpy:latest
container_name: phanpy
ports:
- 8080:80
```

### Custom-build way

Requires [Node.js](https://nodejs.org/).
Expand Down