feat: Initial minimal docker compose and updates to release workflows.
Some checks failed
CI / Linux Tests (push) Has been cancelled
Some checks failed
CI / Linux Tests (push) Has been cancelled
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
name: Create and publish a Docker image
|
name: Create and publish a Docker image
|
||||||
|
|
||||||
# Configures this workflow to run every time a change is pushed to the branch called `release`.
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
# branches: ['main']
|
# branches: ['main']
|
||||||
@@ -8,17 +7,13 @@ on:
|
|||||||
- '*.*.*'
|
- '*.*.*'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# Defines two custom environment variables for the workflow. These are used for the Container registry domain,
|
|
||||||
# and a name for the Docker image that this workflow builds.
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: git.housh.dev
|
REGISTRY: git.housh.dev
|
||||||
IMAGE_NAME: ductcalc
|
IMAGE_NAME: ductcalc
|
||||||
|
|
||||||
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push-image:
|
build-and-push-image:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
@@ -27,17 +22,14 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
# Uses the `docker/login-action` action to log in to the Container registry registry using the account
|
|
||||||
# and password that will publish the packages. Once published, the packages are scoped to the account defined here.
|
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ gitea.actor }}
|
username: ${{ gitea.actor }}
|
||||||
password: ${{ secrets.CONTAINER_TOKEN }}
|
password: ${{ secrets.CONTAINER_TOKEN }}
|
||||||
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels
|
|
||||||
# that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a
|
|
||||||
# subsequent step. The `images` value provides the base name for the tags and labels.
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
||||||
@@ -46,19 +38,18 @@ jobs:
|
|||||||
tags: |
|
tags: |
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major.minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
type=sha
|
type=sha
|
||||||
type=raw,value=prod
|
type=raw,value=latest
|
||||||
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If
|
|
||||||
# the build succeeds, it pushes the image to GitHub Packages. It uses the `context` parameter to define the build's context
|
|
||||||
# as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)"
|
|
||||||
# in the README of the `docker/build-push-action` repository.
|
|
||||||
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
id: push
|
id: push
|
||||||
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
|
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: docker/Dockerfile
|
file: docker/Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|||||||
23
.github/workflows/release.yaml
vendored
23
.github/workflows/release.yaml
vendored
@@ -1,6 +1,5 @@
|
|||||||
name: Create and publish a Docker image
|
name: Create and publish a Docker image
|
||||||
|
|
||||||
# Configures this workflow to run every time a change is pushed to the branch called `release`.
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
# branches: ['main']
|
# branches: ['main']
|
||||||
@@ -8,17 +7,13 @@ on:
|
|||||||
- '*.*.*'
|
- '*.*.*'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
# Defines two custom environment variables for the workflow. These are used for the Container registry domain,
|
|
||||||
# and a name for the Docker image that this workflow builds.
|
|
||||||
env:
|
env:
|
||||||
REGISTRY: ghcr.io
|
REGISTRY: ghcr.io
|
||||||
IMAGE_NAME: ductcalc
|
IMAGE_NAME: ductcalc
|
||||||
|
|
||||||
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push-image:
|
build-and-push-image:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
packages: write
|
packages: write
|
||||||
@@ -27,17 +22,14 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
# Uses the `docker/login-action` action to log in to the Container registry registry using the account
|
|
||||||
# and password that will publish the packages. Once published, the packages are scoped to the account defined here.
|
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ${{ env.REGISTRY }}
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ github.repository_owner }}
|
username: ${{ github.repository_owner }}
|
||||||
password: ${{ secrets.CONTAINER_TOKEN }}
|
password: ${{ secrets.CONTAINER_TOKEN }}
|
||||||
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels
|
|
||||||
# that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a
|
|
||||||
# subsequent step. The `images` value provides the base name for the tags and labels.
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
@@ -46,19 +38,18 @@ jobs:
|
|||||||
tags: |
|
tags: |
|
||||||
type=ref,event=branch
|
type=ref,event=branch
|
||||||
type=semver,pattern={{version}}
|
type=semver,pattern={{version}}
|
||||||
|
type=semver,pattern={{major.minor}}
|
||||||
|
type=semver,pattern={{major}}
|
||||||
type=sha
|
type=sha
|
||||||
type=raw,value=prod
|
type=raw,value=latest
|
||||||
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If
|
|
||||||
# the build succeeds, it pushes the image to GitHub Packages. It uses the `context` parameter to define the build's context
|
|
||||||
# as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)"
|
|
||||||
# in the README of the `docker/build-push-action` repository.
|
|
||||||
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
id: push
|
id: push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: docker/Dockerfile
|
file: docker/Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|||||||
22
docker/docker-compose.yaml
Normal file
22
docker/docker-compose.yaml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: docker.io/postgres:18
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file: .env
|
||||||
|
volumes:
|
||||||
|
- ./data:/var/lib/postgresql
|
||||||
|
|
||||||
|
app:
|
||||||
|
image: ghcr.io/m-housh/ductcalc:latest
|
||||||
|
restart: unless-stopped
|
||||||
|
env_file: .env
|
||||||
|
depends_on:
|
||||||
|
- db
|
||||||
|
ports:
|
||||||
|
- 8080:8080
|
||||||
|
healthcheck:
|
||||||
|
test: curl --fail --silent http://0.0.0.0:8080/health || exit 1
|
||||||
|
interval: 1m
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
20
docker/example.env
Normal file
20
docker/example.env
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# Shared with database & app
|
||||||
|
POSTGRES_USER=ductcalc
|
||||||
|
POSTGRES_PASSWORD=super-secret-change-me
|
||||||
|
POSTGRES_DB=ductcalc
|
||||||
|
|
||||||
|
# App only
|
||||||
|
#
|
||||||
|
POSTGRES_HOSTNAME=db
|
||||||
|
|
||||||
|
# If using sqlite not postgres
|
||||||
|
#SQLITE_PATH=db.sqlite
|
||||||
|
|
||||||
|
# Set the pdf engine to use, this generally does not
|
||||||
|
# need set, unless extending the base image.
|
||||||
|
#PDF_ENGINE=weasyprint
|
||||||
|
|
||||||
|
# Set the path to the pandoc executable. This generally
|
||||||
|
# does not need set, unless extending the base image.
|
||||||
|
#PANDOC_PATH=/usr/bin/pandoc
|
||||||
|
|
||||||
Reference in New Issue
Block a user