Skip to content

Commit

Permalink
Fix todos
Browse files Browse the repository at this point in the history
  • Loading branch information
johnmaguire committed Jan 9, 2024
1 parent 3430b36 commit e7dbe87
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,32 +113,44 @@ jobs:
name: Create and Upload Docker Images
# Technically we only need build-linux to succeed, but if any platforms fail we'll
# want to investigate and restart the build
needs: [build-linux, build-darwin, build-windows, build-freebsd]
needs: [build-linux, build-darwin, build-windows]
runs-on: ubuntu-latest
env:
HAS_DOCKER_CREDS: ${{ vars.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }}
# XXX It's not possible to write a conditional here, so instead we do it on every step
#if: ${{ env.HAS_DOCKER_CREDS == 'true' }}
steps:
# Be sure to checkout the code before downloading artifacts, or they will
# be overwritten
- name: Checkout code
if: ${{ env.HAS_DOCKER_CREDS == 'true' }}
uses: actions/checkout@v3

- name: Download artifacts
if: ${{ env.HAS_DOCKER_CREDS == 'true' }}
uses: actions/download-artifact@v2
with:
name: linux-latest
path: ./release/linux/

- name: Login to Docker Hub
if: ${{ env.HAS_DOCKER_CREDS == 'true' }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set up Docker Buildx
if: ${{ env.HAS_DOCKER_CREDS == 'true' }}
uses: docker/setup-buildx-action@v3

- name: Build and push images
if: ${{ env.HAS_DOCKER_CREDS == 'true' }}
env:
DOCKER_IMAGE_REPO: ${{ vars.DOCKER_IMAGE_REPO || 'nebulaoss/nebula' }}
DOCKER_IMAGE_TAG: ${{ vars.DOCKER_IMAGE_TAG || 'latest' }}
run: |
make DOCKER_BUILD_ARGS="--push" all-docker
make BUILD_NUMBER="${GITHUB_REF#refs/tags/v}" DOCKER_IMAGE_REPO="${DOCKER_IMAGE_REPO}" DOCKER_BUILD_ARGS="--push" all-docker
release:
name: Create and Upload Release
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ ifndef BUILD_NUMBER
endif
endif

ifndef DOCKER_IMAGE_REPO
DOCKER_IMAGE_REPO = nebula
endif
ifndef DOCKER_IMAGE_TAG
DOCKER_IMAGE_TAG = lates
endif

LDFLAGS = -X main.Build=$(BUILD_NUMBER)

ALL_LINUX = linux-amd64 \
Expand Down Expand Up @@ -162,7 +169,7 @@ build/nebula-%.zip: build/%/nebula.exe build/%/nebula-cert.exe
cd build/$* && zip ../nebula-$*.zip nebula.exe nebula-cert.exe

docker/%: build/%/nebula build/%/nebula-cert
docker buildx build . $(DOCKER_BUILD_ARGS) -f docker/Dockerfile --platform "$(subst -,/,$*)" --build-arg SOURCEDIR="build/$*" --tag "nebula:latest" --tag "nebula:$(BUILD_NUMBER)"
docker buildx build . $(DOCKER_BUILD_ARGS) -f docker/Dockerfile --platform "$(subst -,/,$*)" --build-arg SOURCEDIR="build/$*" --tag "${DOCKER_IMAGE_REPO}:${DOCKER_IMAGE_TAG}" --tag "${DOCKER_IMAGE_REPO}:$(BUILD_NUMBER)"

vet:
go vet $(VET_FLAGS) -v ./...
Expand Down
5 changes: 4 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ RUN chmod +x /main.sh

VOLUME ["/config"]

CMD ["/main.sh"]
# Run nebula using a wrapper script to setup the tun device
ENTRYPOINT ["/main.sh"]
# Allow users to override the args passed to nebula
CMD ["-config", "/config/config.yml"]
2 changes: 1 addition & 1 deletion docker/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ if [ ! -c /dev/net/tun ]; then
chmod 600 /dev/net/tun
fi

nebula -config /config/config.yml
nebula "$@"

0 comments on commit e7dbe87

Please sign in to comment.