This repository has been archived by the owner on Oct 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add Dockerfile, Docker-Compose example and build and push Image for G…
…itHub
- Loading branch information
TMH
committed
Feb 28, 2024
1 parent
9b858e5
commit e8d155d
Showing
3 changed files
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: '3.7' | ||
services: | ||
porygon: | ||
image: ghcr.io/roundaboutluke/porygon:main | ||
container_name: porygon | ||
restart: unless-stopped | ||
volumes: | ||
# mount the config.toml file and persistent storage for MessageIDs | ||
- ${PWD}/config.toml:/porygon/config.toml | ||
- ${PWD}/messageIDs.json:/porygon/messageIDs.json # file must be created before the first start the container (touch messageIDs.json) | ||
# optional if you want to use your own template | ||
# comment if not needed | ||
- ${PWD}/current.override.json:/porygon/templates/current.override.json | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: publish | ||
|
||
on: [push] | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Build image | ||
FROM golang:1.21-alpine as build | ||
|
||
WORKDIR /go/src/app | ||
COPY go.mod go.sum ./ | ||
RUN if [ ! -f vendor/modules.txt ]; then go mod download; fi | ||
|
||
COPY . . | ||
RUN CGO_ENABLED=0 go build -o /go/bin/porygon | ||
|
||
# Now copy it into our base image. | ||
FROM gcr.io/distroless/static-debian12 as runner | ||
COPY --from=build /go/bin/porygon /porygon/ | ||
COPY default.toml /porygon/ | ||
COPY /templates /porygon/templates | ||
|
||
WORKDIR /porygon | ||
CMD ["./porygon"] |