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

Add GHA for dockerhub builds #523

Merged
merged 13 commits into from
Mar 1, 2022
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
55 changes: 55 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,58 @@ jobs:
run: |
make docker-build
make docker-push

push-dockerhub:
env:
DOCKER_REGISTRY: "docker.io/"
DOCKER_REPOSITORY: "omecproject/"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.4.0

- run: echo GIT_SHA_SHORT=$(git rev-parse --short HEAD) >> $GITHUB_ENV

- id: docker-login
# Secrets from the main repo are not used if PR comes from fork. We skip pushing Docker image then.
if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'
uses: docker/login-action@v1.13.0
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_LOGIN }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push "master-latest" Docker images for Haswell CPU
env:
DOCKER_TAG: master-latest
CPU: haswell
run: |
docker pull ${DOCKER_REPOSITORY}upf-epc-bess:$DOCKER_TAG
docker pull ${DOCKER_REPOSITORY}upf-epc-pfcpiface:$DOCKER_TAG
CPU=$CPU make docker-build
make docker-push

- name: Build and push "master-GIT_SHA" Docker images for Haswell CPU
env:
DOCKER_TAG: master-latest-${{ env.GIT_SHA_SHORT }}
CPU: haswell
run: |
CPU=$CPU make docker-build
make docker-push

- name: Build and push "master-latest-ivybridge" Docker images for Ivybridge CPU
env:
DOCKER_TAG: master-latest-ivybridge
CPU: ivybridge
run: |
docker pull ${DOCKER_REPOSITORY}upf-epc-bess:$DOCKER_TAG
docker pull ${DOCKER_REPOSITORY}upf-epc-pfcpiface:$DOCKER_TAG
CPU=$CPU make docker-build
make docker-push

- name: Build and push "master-GIT_SHA-ivybridge" Docker images for Ivybridge CPU
env:
DOCKER_TAG: master-latest-ivybridge-${{ env.GIT_SHA_SHORT }}
CPU: ivybridge
run: |
CPU=$CPU make docker-build
make docker-push
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,13 @@ PTF_PB_DIR ?= ptf/lib
# https://docs.docker.com/engine/reference/commandline/build/#specifying-target-build-stage---target
docker-build:
for target in $(DOCKER_TARGETS); do \
DOCKER_CACHE_ARG=""; \
if [ $(DOCKER_BUILDKIT) = 1 ]; then \
DOCKER_CACHE_ARG="--cache-from ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}upf-epc-$$target:${DOCKER_TAG}"; \
fi; \
DOCKER_BUILDKIT=$(DOCKER_BUILDKIT) docker build $(DOCKER_PULL) $(DOCKER_BUILD_ARGS) \
--target $$target \
$$DOCKER_CACHE_ARG \
--tag ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}upf-epc-$$target:${DOCKER_TAG} \
--label org.opencontainers.image.source="https://github.com/omec-project/upf-epc" \
--label org.label.schema.version="${VERSION}" \
Expand Down