Skip to content

Build and publish container images #151

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

mbaum0
Copy link
Contributor

@mbaum0 mbaum0 commented Feb 11, 2025

Closes: #150

This PR adds 2 new workflows

  1. build-and-push-table-image: Whenever a new tag is created in the form of v*.*.*, this workflow will be triggered and container images will be built and pushed to ghcr with the provided version as a tag.
  2. build-and-push-test-image: Runs on PRs that are opened on main. This is so we can test that the image build is successful with the changes, and also so one can test the actual image in deployment before merging.

Other changes:

  • Add instructions to the readme for deployment using docker compose
  • Updated the Dockerfile to support running consecutive builds on different architectures. This way we can publish arm64 and amd64 images in the same CI workflow.

@balzack I think you'll need to setup a GITHUB_TOKEN secret in the repository settings with write access to packages

Could someone look over the doc changes and let me know if they make sense?

Copy link
Owner

@balzack balzack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I've read, the permissions list in the .yml file dictates the granted permissions. Let me know if there is somewhere else to enable package permission for the token.

This seems good to me, but containers aren't my strength, so hopefully someone else can take validate the PR, @lil5 ?

@lil5
Copy link
Contributor

lil5 commented Feb 12, 2025

The test pr seems a bit overkill, it's faster to checkout the pr locally and try it than waiting for GitHub to build it, then copy over locally.

Someone even without any knowledge of git can use the GitHub instructions of their GitHub cli then run the dev docker compose.

Two commands:

gh pr checkout 1337
make dev-start

Comment on lines +31 to 34
RUN --mount=type=cache,target=/go/pkg/mod go mod download

ARG DATABAG_GOARCH
ARG DATABAG_GOOS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the args be placed first or doesn't that matter?

Comment on lines -6 to -13

# # For building cross environment containers
# build:
# context: .
# args:
# DATABAG_GOARCH: arm64
# DATABAG_GOOS: linux
# platform: "linux/arm64"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why remove this?

@lil5
Copy link
Contributor

lil5 commented Feb 12, 2025

Great improvements on the cache locations 👍

@lil5
Copy link
Contributor

lil5 commented Feb 12, 2025

Would you be able to test this code on a personal public Fork? It a bit iffy to merge without testing the full process.

COPY ./net/web/package.json ./net/web/yarn.lock ./
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn \
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn/v6,sharing=locked \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using sharing=locked could be an issue if 2 PRs are created at once

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Workflow to publish container image to GHCR
3 participants