Skip to content
This repository has been archived by the owner on Oct 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #20 from TMHBOFH/main
Browse files Browse the repository at this point in the history
add Docker Stuf
  • Loading branch information
roundaboutluke authored Feb 28, 2024
2 parents 9b858e5 + e8d155d commit 8a9af05
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/docker-compose.yml.example
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

35 changes: 35 additions & 0 deletions .github/workflows/publish.yml
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 }}
18 changes: 18 additions & 0 deletions Dockerfile
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"]

0 comments on commit 8a9af05

Please sign in to comment.