Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Build Image

on:
push:

concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

jobs:
check-flake:
runs-on: ci-ocf-wordpress
steps:
- uses: actions/checkout@v5
- uses: DeterminateSystems/flake-checker-action@v9

build:
runs-on: ci-ocf-wordpress
needs: check-flake
steps:
- uses: actions/checkout@v5
- name: Build image
run: sh $(nix build .#image --no-link --print-out-paths) > /dev/null
57 changes: 57 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build and Publish Image

on:
pull_request:
push:
branches:
- main

env:
image_name: ocf-wordpress-core
registry: ghcr.io/${{ github.repository_owner }}

jobs:
publish:
# requires setting up a proper environment in the runner
#runs-on: ci-ocf-wordpress
Comment thread
sophiebsw marked this conversation as resolved.
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v5

- uses: cachix/install-nix-action@v31

- name: Build and tag image
run: |
#mkdir -p /etc/containers && podman image trust set --type accept default


Comment thread
sophiebsw marked this conversation as resolved.
IMAGE_TAG=$(sh $(nix build .#image --no-link --print-out-paths) 2>/dev/null | podman load -q | grep -oe "$image_name:.*$" | sed -e "s/$image_name://")

echo "image_tags=$IMAGE_TAG" >> $GITHUB_ENV

- name: Tag latest
if: github.ref == 'refs/heads/main'
run: |
podman tag $image_name:$image_tags $image_name:latest

echo "image_tags=$image_tags latest" >> $GITHUB_ENV

- name: Log in to GHCR
uses: redhat-actions/podman-login@v1
with:
username: ${{ github.actor }}
password: ${{ github.token }}
registry: ${{ env.registry }}

- name: Push to GHCR
id: push-ghcr
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ env.image_name }}
tags: ${{ env.image_tags }}
registry: ${{ env.registry }}

- name: Print image url
run: echo "Image pushed to ${{ steps.push-ghcr.outputs.registry-paths }}"
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# OCF Wordpress

For development, the image can be built and added to Docker with the following command:
`nix build .#docker && docker tag $(docker load -q < result | grep --only-matching -e 'ocf-wordpress-core:.*$') ocf-wordpress-core:latest`
`docker tag $(sh $(nix build .#image --no-link --print-out-paths) 2>/dev/null | docker load -q | grep -oe "ocf-wordpress-core:.*$") ocf-wordpress-core:latest`
or
`podman tag $(sh $(nix build .#image --no-link --print-out-paths) 2>/dev/null | podman load -q | grep -oe "ocf-wordpress-core:.*$") ocf-wordpress-core:latest`

A docker compose file is provided as a testing environment. This should never be used in any production setting or exposed publicly. You can start this by running:
`docker compose up -d`
Comment thread
sophiebsw marked this conversation as resolved.
Expand Down
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
);
in
{
docker = pkgs.dockerTools.buildLayeredImage {
image = pkgs.dockerTools.streamLayeredImage {
name = "ocf-wordpress-core";
created = timestamp;
mtime = timestamp;
Expand Down
Loading