Skip to content
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

Push Docker images as part of the release workflow #1037

Merged
merged 22 commits into from
May 2, 2024
Merged

Conversation

johnmaguire
Copy link
Collaborator

@johnmaguire johnmaguire commented Dec 8, 2023

Closes #25.

Description

This PR adds a Github Actions workflow to build and push Docker images whenever a new release is tagged. The image is pushed with a version tag, as well as with the latest tag. This allows users to choose between manual updates or automatic updates by pinning to the latest tag.

With this image, you can provide Nebula connectivity to your Docker host while running Nebula inside a container:

docker run \
    --name nebula \
    --network host \
    --cap-add NET_ADMIN \
    --volume ./config:/etc/nebula \
    --rm \
    nebulaoss/nebula

In the example above, you must create a config directory containing a valid config.yml. Here is the same configuration, but with docker-compose:

version: '2'
services:
  nebula:
    image: nebulaoss/nebula
    network_mode: host
    cap_add:
      - NET_ADMIN
    volumes:
      - ./config:/etc/nebula
    restart: unless-stopped

This image also allows overriding the args passed to Nebula:

❯ docker run nebulaoss/nebula -version
Version: 0.0.11

This can be used to allow using a config directory instead of a config file, for example.

Github Actions Details

If DOCKERHUB_USERNAME and DOCKERHUB_TOKEN are not set, every step in the build-docker job of the release workflow is skipped. This avoids a "failed" status in forks that want to create repo-local releases without pushing to Docker. The tradeoff is that it could indicate a false success when the required variables are not configured.

Variables

Required:

  • DOCKERHUB_USERNAME (variable)
  • DOCKERHUB_TOKEN (secret) - must be read/write

Optional:

  • DOCKER_REPO_NAME (variable) - defaults to "nebulaoss/nebula"
  • DOCKER_REPO_TAG (variable) - defaults to "latest" (e.g. can be overridden to "unstable")

Todo

  • Configure Docker secrets in this repo
  • Update nebulaoss/nightly with its own Docker secrets and repo

@johnmaguire johnmaguire added this to the v1.9.0 milestone Dec 8, 2023
@johnmaguire johnmaguire requested a review from wadey January 9, 2024 22:37
@johnmaguire johnmaguire changed the title WIP Dockerfile Push Docker images as part of the release workflow Jan 10, 2024
Makefile Outdated Show resolved Hide resolved
@johnmaguire
Copy link
Collaborator Author

I just noticed that this branch had old code, and was not up-to-date with my personal repo's branch. I just pushed an update.

@johnmaguire johnmaguire mentioned this pull request Apr 1, 2024
docker/main.sh Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
Copy link
Collaborator Author

@johnmaguire johnmaguire left a comment

Choose a reason for hiding this comment

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

@wadey The changes look great. I really like the distroless approach! Thanks for all the help here!

Makefile Outdated Show resolved Hide resolved
Co-authored-by: John Maguire <[email protected]>
Makefile Outdated Show resolved Hide resolved
@johnmaguire johnmaguire merged commit b5c3486 into master May 2, 2024
8 checks passed
@johnmaguire johnmaguire deleted the docker branch May 2, 2024 13:37
@wadey wadey mentioned this pull request May 6, 2024
28 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docker image
3 participants