image builder

This commit is contained in:
Victoria Nadasdi 2024-04-16 17:59:57 +02:00
commit cfe0d7568c
No known key found for this signature in database
GPG key ID: 58E2D23885002DC5
3 changed files with 67 additions and 0 deletions

View file

@ -0,0 +1,46 @@
name: Publish Docker image
on:
workflow_dispatch:
inputs:
phanpy_version:
description: Target Phanpy version
required: true
type: string
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build_and_push_to_registry:
name: "Build and Push to Registry: phanpy ${{ inputs.phanpy_version }}"
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags:
type=semver,pattern={{version}},value=${{ inputs.phanpy_version }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
build-args: |
VERSION=${{ inputs.phanpy_version }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

17
Dockerfile Normal file
View file

@ -0,0 +1,17 @@
from alpine:3.19 as builder
ARG VERSION
run apk add --update curl
run curl -sLO "https://github.com/cheeaun/phanpy/releases/download/${VERSION}/phanpy-dist.tar.gz" \
&& mkdir /phanpy \
&& tar zxf phanpy-dist.tar.gz -C /phanpy
from nginx:1.25.4-alpine
label maintainer="Victoria Nadasdi <efertone@pm.me>"
label org.opencontainers.image.source=https://github.com/yitsushi/phanpy-docker
label org.opencontainers.image.description="Unofficial Docker Image for Phanpy"
label org.opencontainers.image.licenses=MIT
copy --from=builder /phanpy /usr/share/nginx/html

4
Makefile Normal file
View file

@ -0,0 +1,4 @@
VERSION := unknown
build:
docker build --build-arg VERSION=$(VERSION) -t phanpy-docker:$(VERSION) .