Skip to content

Commit

Permalink
add docker image, workflow file
Browse files Browse the repository at this point in the history
  • Loading branch information
denyskon committed Jan 5, 2024
1 parent bcd7dae commit f923d6e
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
example.postalion.yml
postalion.yml
postalion

LICENSE
README.md
.git
.github

42 changes: 42 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: build and publish a Docker image

on:
push:
tags:
- 'v*'

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@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
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM golang:1.21-alpine AS build-stage

WORKDIR /usr/src/app

COPY go.mod go.sum ./
RUN go mod download

COPY . .

RUN go build -o /app/postalion

COPY templates /app/templates

VOLUME /app/templates

WORKDIR /app

EXPOSE 8080

ENTRYPOINT ["/app/postalion"]
37 changes: 37 additions & 0 deletions example.postalion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
mailAccounts:
test-account:
host: mail.example.com
port: 587
username: [email protected]
password: p@ssword
encryption: starttls
forms:
test-form:
account: test-account
from: "Postalion <[email protected]>"
to: "Contact <[email protected]>"
honeypot: honeypot
replyTo:
format: "%s <%s>"
fields:
- name
- email
subjectField: subject
template: default
redirect: https://example.com/pages/contact-redirect
fields:
- name: name
label: Name
type: string
- name: email
label: Email
type: string
- name: subject
label: Subject
type: string
- name: file
label: File
type: file
port: 8080
templateDir: /app/data/templates
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func initConfig() {
v.SetConfigName("postalion")
v.AddConfigPath(".")
v.AddConfigPath("/etc/postalion")
v.AddConfigPath("/data")
v.AddConfigPath("/app")
v.SetEnvPrefix("postalion")
v.AutomaticEnv()

Expand Down

0 comments on commit f923d6e

Please sign in to comment.