github container repo (#3034)
update dockerfiles to include required label for github container repo reference tags are generated for both locations using build-docker-image push to ghcr.io using module for login in and push
This commit is contained in:
parent
2bca6e9ff6
commit
abba607428
12 changed files with 112 additions and 46 deletions
10
.github/workflows/beta_artifacts.yml
vendored
10
.github/workflows/beta_artifacts.yml
vendored
|
@ -73,7 +73,15 @@ jobs:
|
|||
run: TRAVIS_TAG=${TAG} ci/actions/linux/deploy-docker.sh
|
||||
env:
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Login to ghcr.io
|
||||
uses: docker/login-action@adb7347
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GHCR_PAT }}
|
||||
- name: Deploy Docker (ghcr.io)
|
||||
run: ci/actions/linux/ghcr_push.sh
|
||||
|
||||
windows_job:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
|
|
8
.github/workflows/develop.yml
vendored
8
.github/workflows/develop.yml
vendored
|
@ -13,6 +13,14 @@ jobs:
|
|||
run: git submodule update --init --recursive
|
||||
- name: Fetch Deps
|
||||
run: ci/actions/linux/install_deps.sh
|
||||
- name: Login to ghcr.io
|
||||
uses: docker/login-action@adb7347
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GHCR_PAT }}
|
||||
- name: Deploy Docker (ghcr.io)
|
||||
run: ci/actions/linux/ghcr_push.sh
|
||||
- name: Deploy Docker (nanocurrency/nano-env)
|
||||
run: ci/actions/linux/deploy-docker.sh
|
||||
env:
|
||||
|
|
8
.github/workflows/live_artifacts.yml
vendored
8
.github/workflows/live_artifacts.yml
vendored
|
@ -72,6 +72,14 @@ jobs:
|
|||
run: TRAVIS_TAG=${TAG} ci/actions/linux/deploy-docker.sh
|
||||
env:
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Login to ghcr.io
|
||||
uses: docker/login-action@adb7347
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GHCR_PAT }}
|
||||
- name: Deploy Docker (ghcr.io
|
||||
run: ci/actions/linux/ghcr_push.sh
|
||||
|
||||
windows_job:
|
||||
runs-on: windows-latest
|
||||
|
|
10
.github/workflows/test_network_artifacts.yml
vendored
10
.github/workflows/test_network_artifacts.yml
vendored
|
@ -72,7 +72,15 @@ jobs:
|
|||
run: TRAVIS_TAG=${TAG} ci/actions/linux/deploy-docker.sh
|
||||
env:
|
||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Login to ghcr.io
|
||||
uses: docker/login-action@adb7347
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.repository_owner }}
|
||||
password: ${{ secrets.GHCR_PAT }}
|
||||
- name: Deploy Docker (ghcr.io)
|
||||
run: ci/actions/linux/ghcr_push.sh
|
||||
|
||||
windows_job:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
|
|
|
@ -2,11 +2,49 @@
|
|||
|
||||
set -e
|
||||
|
||||
|
||||
scripts="$PWD/ci"
|
||||
TRAVIS_BRANCH=`git branch| cut -f2 -d' '`
|
||||
tags=()
|
||||
if [ -n "$TRAVIS_TAG" ]; then
|
||||
tags+=("$TRAVIS_TAG" latest)
|
||||
if [[ "$GITHUB_WORKFLOW" = "Beta" || "$GITHUB_WORKFLOW" = "TestNetwork" ]]; then
|
||||
tags+=(latest-including-rc)
|
||||
fi
|
||||
elif [ -n "$TRAVIS_BRANCH" ]; then
|
||||
TRAVIS_TAG=$TRAVIS_BRANCH
|
||||
tags+=("$TRAVIS_BRANCH")
|
||||
fi
|
||||
if [[ "$GITHUB_WORKFLOW" = "Live" ]]; then
|
||||
echo "Live"
|
||||
network_tag_suffix=''
|
||||
network="live"
|
||||
elif [[ "$GITHUB_WORKFLOW" = "Beta" ]]; then
|
||||
echo "Beta"
|
||||
network_tag_suffix="-beta"
|
||||
network="beta"
|
||||
elif [[ "$GITHUB_WORKFLOW" = "TestNetwork" ]]; then
|
||||
echo "Test"
|
||||
network_tag_suffix="-test"
|
||||
network="test"
|
||||
fi
|
||||
if [[ "$GITHUB_WORKFLOW" != "Develop" ]]; then
|
||||
docker_image_name="nanocurrency/nano${network_tag_suffix}"
|
||||
ghcr_image_name="ghcr.io/${GITHUB_REPOSITORY}/nano${network_tag_suffix}"
|
||||
"$scripts"/build-docker-image.sh docker/node/Dockerfile "$docker_image_name" --build-arg NETWORK="$network" --build-arg CI_BUILD=true --build-arg TRAVIS_TAG="$TRAVIS_TAG"
|
||||
for tag in "${tags[@]}"; do
|
||||
# Sanitize docker tag
|
||||
# https://docs.docker.com/engine/reference/commandline/tag/
|
||||
tag="$(printf '%s' "$tag" | tr -c '[a-z][A-Z][0-9]_.-' -)"
|
||||
if [ "$tag" != "latest" ]; then
|
||||
docker tag "$docker_image_name" "${docker_image_name}:$tag"
|
||||
docker tag "$ghcr_image_name" "${ghcr_image_name}:$tag"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$DOCKER_PASSWORD" ]; then
|
||||
echo "$DOCKER_PASSWORD" | docker login -u nanoreleaseteam --password-stdin
|
||||
|
||||
scripts="$PWD/ci"
|
||||
TRAVIS_BRANCH=`git branch| cut -f2 -d' '`
|
||||
if [[ "$GITHUB_WORKFLOW" = "Develop" ]]; then
|
||||
"$scripts"/custom-timeout.sh 30 docker push "nanocurrency/nano-env:base"
|
||||
"$scripts"/custom-timeout.sh 30 docker push "nanocurrency/nano-env:gcc"
|
||||
|
@ -14,46 +52,13 @@ if [ -n "$DOCKER_PASSWORD" ]; then
|
|||
echo "Deployed nano-env"
|
||||
exit 0
|
||||
else
|
||||
tags=()
|
||||
if [ -n "$TRAVIS_TAG" ]; then
|
||||
tags+=("$TRAVIS_TAG" latest)
|
||||
if [[ "$GITHUB_WORKFLOW" = "Beta" || "$GITHUB_WORKFLOW" = "TestNetwork" ]]; then
|
||||
tags+=(latest-including-rc)
|
||||
fi
|
||||
elif [ -n "$TRAVIS_BRANCH" ]; then
|
||||
TRAVIS_TAG=$TRAVIS_BRANCH
|
||||
tags+=("$TRAVIS_BRANCH")
|
||||
fi
|
||||
if [[ "$GITHUB_WORKFLOW" = "Live" ]]; then
|
||||
echo "Live"
|
||||
network_tag_suffix=''
|
||||
network="live"
|
||||
elif [[ "$GITHUB_WORKFLOW" = "Beta" ]]; then
|
||||
echo "Beta"
|
||||
network_tag_suffix="-beta"
|
||||
network="beta"
|
||||
elif [[ "$GITHUB_WORKFLOW" = "TestNetwork" ]]; then
|
||||
echo "Test"
|
||||
network_tag_suffix="-test"
|
||||
network="test"
|
||||
else
|
||||
echo "Nothing to deploy"
|
||||
exit 1
|
||||
fi
|
||||
docker_image_name="nanocurrency/nano${network_tag_suffix}"
|
||||
"$scripts"/custom-timeout.sh 30 docker build --build-arg NETWORK="$network" --build-arg CI_BUILD=true --build-arg TRAVIS_TAG="$TRAVIS_TAG" -f docker/node/Dockerfile -t "$docker_image_name" .
|
||||
for tag in "${tags[@]}"; do
|
||||
# Sanitize docker tag
|
||||
# https://docs.docker.com/engine/reference/commandline/tag/
|
||||
tag="$(printf '%s' "$tag" | tr -c '[a-z][A-Z][0-9]_.-' -)"
|
||||
if [ "$tag" != "latest" ]; then
|
||||
docker tag "$docker_image_name" "${docker_image_name}:$tag"
|
||||
fi
|
||||
"$scripts"/custom-timeout.sh 30 docker push "${docker_image_name}:$tag"
|
||||
tags=`docker images --format '{{.Repository}}:{{.Tag }}'| grep nanocurrency |grep -vE "env|ghcr.io|none"`
|
||||
for a in $tags; do
|
||||
"$scripts"/custom-timeout.sh 30 docker push "$a"
|
||||
done
|
||||
echo "$docker_image_name with tags ${tags//$'\n'/' '} deployed"
|
||||
fi
|
||||
echo "$docker_image_name with tags ${tags[*]} deployed"
|
||||
else
|
||||
echo "\$DOCKER_PASSWORD environment variable required"
|
||||
exit 1
|
||||
exit 0
|
||||
fi
|
15
ci/actions/linux/ghcr_push.sh
Executable file
15
ci/actions/linux/ghcr_push.sh
Executable file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
|
||||
scripts="$PWD/ci"
|
||||
if [[ "$GITHUB_WORKFLOW" = "Develop" ]]; then
|
||||
"$scripts"/custom-timeout.sh 30 docker push "ghcr.io/${GITHUB_REPOSITORY}/nano-env:base"
|
||||
"$scripts"/custom-timeout.sh 30 docker push "ghcr.io/${GITHUB_REPOSITORY}/nano-env:gcc"
|
||||
"$scripts"/custom-timeout.sh 30 docker push "ghcr.io/${GITHUB_REPOSITORY}/nano-env:clang-6"
|
||||
else
|
||||
tags=`docker images --format '{{.Repository}}:{{.Tag }}'| grep "ghcr.io" | grep -vE "env|none"`
|
||||
for a in $tags; do
|
||||
"$scripts"/custom-timeout.sh 30 docker push "$a"
|
||||
done
|
||||
fi
|
|
@ -8,10 +8,13 @@ fi
|
|||
|
||||
dockerFile="$1"
|
||||
dockerTag="$2"
|
||||
githubTag="ghcr.io/${GITHUB_REPOSITORY}/${dockerTag#*/}"
|
||||
shift; shift
|
||||
|
||||
scripts="$(dirname "$0")"
|
||||
|
||||
"$scripts"/custom-timeout.sh 20 docker pull "${dockerTag}" || true
|
||||
echo "Building $dockerTag"
|
||||
"$scripts"/custom-timeout.sh 30 docker build "$@" -f "${dockerFile}" -t "${dockerTag}" --cache-from "${dockerTag}" .
|
||||
"$scripts"/custom-timeout.sh 20 docker pull "${githubTag}" || true
|
||||
echo "Building $githubTag"
|
||||
"$scripts"/custom-timeout.sh 30 docker build "$@" --build-arg REPOSITORY=${GITHUB_REPOSITORY} -f "${dockerFile}" -t "${githubTag}" --cache-from "${githubTag}" .
|
||||
echo "Tagging ${dockerTag} from ${githubTag}"
|
||||
docker tag $githubTag $dockerTag
|
|
@ -17,3 +17,6 @@ RUN apt-get update -qq && apt-get install -yqq \
|
|||
qt5-default \
|
||||
valgrind \
|
||||
xorg xvfb xauth xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic
|
||||
|
||||
ARG REPOSITORY=nanocurrency/nano-node
|
||||
LABEL org.opencontainers.image.source https://github.com/$REPOSITORY
|
|
@ -19,3 +19,5 @@ RUN ./fetch_boost.sh
|
|||
# see https://www.boost.org/doc/libs/1_70_0/doc/html/stacktrace/configuration_and_build.html#stacktrace.configuration_and_build.f3
|
||||
|
||||
RUN ln -s /usr/lib/gcc/x86_64-linux-gnu/5/include/backtrace.h /tmp/backtrace.h
|
||||
ARG REPOSITORY=nanocurrency/nano-node
|
||||
LABEL org.opencontainers.image.source https://github.com/$REPOSITORY
|
|
@ -25,3 +25,5 @@ RUN COMPILER=clang-6 ./fetch_boost.sh
|
|||
# see https://www.boost.org/doc/libs/1_70_0/doc/html/stacktrace/configuration_and_build.html#stacktrace.configuration_and_build.f3
|
||||
|
||||
RUN ln -s /usr/lib/gcc/x86_64-linux-gnu/5/include/backtrace.h /tmp/backtrace.h
|
||||
ARG REPOSITORY=nanocurrency/nano-node
|
||||
LABEL org.opencontainers.image.source https://github.com/$REPOSITORY
|
|
@ -7,3 +7,5 @@ ENV BOOST_ROOT=/tmp/boost
|
|||
ADD util/build_prep/fetch_boost.sh fetch_boost.sh
|
||||
|
||||
RUN COMPILER=gcc ./fetch_boost.sh
|
||||
ARG REPOSITORY=nanocurrency/nano-node
|
||||
LABEL org.opencontainers.image.source https://github.com/$REPOSITORY
|
|
@ -40,3 +40,5 @@ USER root
|
|||
ENV PATH="${PATH}:/usr/bin"
|
||||
ENTRYPOINT ["/usr/bin/entry.sh"]
|
||||
CMD ["nano_node", "daemon", "-l"]
|
||||
ARG REPOSITORY=nanocurrency/nano-node
|
||||
LABEL org.opencontainers.image.source https://github.com/$REPOSITORY
|
Loading…
Add table
Add a link
Reference in a new issue