Skip to content

Add pre-build Docker images through GHCR - #217

Merged
XeR merged 21 commits into
TFNS:mainfrom
JJ-8:0-pre-build-docker-images-through-ghcr
Sep 24, 2023
Merged

XeR merged 21 commits into
TFNS:mainfrom
JJ-8:0-pre-build-docker-images-through-ghcr

Conversation

@JJ-8

@JJ-8 JJ-8 commented May 12, 2023 •

Copy link
Copy Markdown
Collaborator

As discussed in #211, I have created the following:

  • The workflow builds and pushes the front, api, db images to GHCR
  • The images are both for amd64 as well as arm64
  • The images are properly tagged with latest, by the branch name and by tag
    • Please note that I was not able to test by tag, but I am pretty sure this works fine since the other two also work as expected
  • The front, api and db images are build concurrently using a matrix build for maximum speed
    • Still the build of the front image takes around 20 minutes due to the arm build
  • A docker-compose.prebuild.yml is provided which extends the original docker-compose.yml to use the pre-build images from GHCR. This gives the option to the user to build the images themself too.
  • Instructions are added to the README
  • A fix was added for building the front Docker container

It is not possible to test this PR before merging. However, you can look at the packages of my fork to see the results. Please note that you should enable the package view on the homepage manually in GitHub through the settings icon (also used to change the description of the project).

For now it is only GHCR because that is the easiest to implement and does not require you to setup secrets. In the near future (as soon as we have fully decided which external Docker hosting platform we are going to use), it is almost trivial to add this as a target too due to the docker/metadata-action step.

JJ-8 added 20 commits March 3, 2023 11:58
The next page arrow did not work but is now fixed.
Also remove the sorting functionality since it does not work.
If you create a CTF which is in the past, it would appear at the bottom of
the past CTF table until you refresh the table.
Now the list is properly sorted which will place the CTF at
the expected place.
This was newly added to the challenge categories as listed at
https://ctf.hackthebox.com/api/public/challengeCategories
The graphql-upload packages has been swapped with graphql-upload-ts,
because it is not possible anymore to use graphql-upload due to import issues.
The SCSS variables are from quasarframework/quasar#15144 (comment)
This fixes the ugly dark shadows in dark mode but keeps the shadows in light mode.
This was added in Quasar 2.11 but reverted using the SCSS patch.

Due to an update of ESLint, it complains about single-word components.
Since this is used in CTFNote, this rule is disabeld.

Also some small (automatic) fixes.
It expects undefined officially, so we return that instead.
Docker images of the front, api and db will be automatically build through
Github workflows and pushed to the Github Container Registry (GHCR)
when a commit is made to the main branch (or when manually triggered).

This makes it possible to install CTFNote on a VPS of 2 GB of RAM since
you don't need to build the container anymore (which requires quite
a lot of RAM). Building the container yourself is still possible
and the default setup for docker compose.

The README is updated with this change.
Futhermore, the REAMDE now points to `docker compose` instead of the
deprecated `docker-compose`.
This workflow is very similar to the Hedgedoc GHCR workflow:
https://github.com/hedgedoc/hedgedoc/blob/develop/.github/workflows/docker.yml
However, there are some slight changes.
This should now tag latest, the branch and all the tagged versions
and build and store their docker images.
This skips the merging step for testing this out.
The `--pull always` makes sure that the image is updated when
executed again.
Was only used for testing purposes.
@JJ-8

JJ-8 commented May 12, 2023

Copy link
Copy Markdown
Collaborator Author

@XeR, would it be possible to revert to merge commits again for merging the PRs? Fast forwarding messes up the commits in the fork (see above commits which are getting marked as new but do not add any content). Furthermore, the network overview in GitHub is wrong since there is no explicit merge done (thus not showing my branches merging into the upstream branch). Unless you highly prefer fast forwarding, merge commits would make it easier for me to contribute to the project :)

@JJ-8
JJ-8 requested a review from XeR May 12, 2023 19:43
@JJ-8
JJ-8 requested a review from SakiiR May 25, 2023 11:43

@XeR XeR left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm trusting you blindly on this new yaml file. If it works for your repo, it'll probably work here too

Comment thread front/Dockerfile
Comment thread README.md Outdated
Comment thread .github/workflows/build-and-publish.yml
@XeR

XeR commented Jul 4, 2023

Copy link
Copy Markdown
Contributor

@XeR, would it be possible to revert to merge commits again for merging the PRs? Fast forwarding messes up the commits in the fork (see above commits which are getting marked as new but do not add any content). Furthermore, the network overview in GitHub is wrong since there is no explicit merge done (thus not showing my branches merging into the upstream branch). Unless you highly prefer fast forwarding, merge commits would make it easier for me to contribute to the project :)

Sure !
I should have read this before merging other PR, sorry.

JJ-8 added a commit to JJ-8/CTFNote that referenced this pull request Jul 21, 2023
Copy of 8efa9ba
but this one is upstream included in TFNS#217.
@JJ-8
JJ-8 requested a review from XeR July 21, 2023 08:43
@XeR
XeR merged commit b58f2b7 into TFNS:main Sep 24, 2023
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.

3 participants