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

github container repo #3034

Merged
merged 1 commit into from
Nov 3, 2020
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
10 changes: 9 additions & 1 deletion .github/workflows/beta_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,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:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/live_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,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
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/test_network_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,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:
Expand Down
87 changes: 46 additions & 41 deletions ci/actions/linux/deploy-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,63 @@

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"
"$scripts"/custom-timeout.sh 30 docker push "nanocurrency/nano-env:clang-6"
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 changes: 15 additions & 0 deletions ci/actions/linux/ghcr_push.sh
Original file line number Diff line number Diff line change
@@ -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
9 changes: 6 additions & 3 deletions ci/build-docker-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions docker/ci/Dockerfile-base
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions docker/ci/Dockerfile-clang
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions docker/ci/Dockerfile-clang-6
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions docker/ci/Dockerfile-gcc
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions docker/node/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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