-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
192 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: Delete-Release | ||
|
||
on: | ||
release: | ||
types: [deleted] # should be deleted | ||
|
||
jobs: | ||
purge-image: | ||
name: Delete image from ghcr.io | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
binary: ["integritee-client", "integritee-service-dev"] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set output | ||
id: vars | ||
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | ||
|
||
- name: Check output | ||
env: | ||
RELEASE_VERSION: ${{ steps.vars.outputs.tag }} | ||
run: | | ||
echo $RELEASE_VERSION | ||
echo ${{ steps.vars.outputs.tag }} | ||
echo ${{github.event.pull_request.number}} | ||
- name: Login to DockerHub | ||
if: github.event_name != 'pull_request' | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
# Unfortunately accessing the repo with personal access token is not possible | ||
# Workaround: disable 2FA and user password instead of TOKEN | ||
- name: Delete docker tag | ||
run: | | ||
ORGANIZATION="integritee" | ||
IMAGE="${{ matrix.binary }}" | ||
TAG="${{ steps.vars.outputs.tag }}" | ||
login_data() { | ||
cat <<EOF | ||
{ | ||
"username": "${{ secrets.DOCKER_HUB_USERNAME }}", | ||
"password": "${{ secrets.DOCKERHUB_PASSWORD }}" | ||
} | ||
EOF | ||
} | ||
TOKEN=`curl -s -H "Content-Type: application/json" -X POST -d "$(login_data)" "https://hub.docker.com/v2/users/login/" | jq -r .token` | ||
curl "https://hub.docker.com/v2/repositories/${ORGANIZATION}/${IMAGE}/tags/${TAG}/" \ | ||
-X DELETE \ | ||
-H "Authorization: JWT ${TOKEN}" | ||
- name: Delete tag as well | ||
uses: dev-drprasad/[email protected] | ||
with: | ||
delete_release: false # it is triggered by release deletion | ||
tag_name: ${{ steps.vars.outputs.tag }} # tag name to delete | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Publish Docker image for new releases | ||
|
||
on: | ||
release: | ||
types: | ||
- published | ||
|
||
jobs: | ||
main: | ||
name: Push Integritee Node to Dockerhub | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
binary: ["integritee-service-dev", "integritee-client"] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Download ${{ matrix.binary }} from release | ||
uses: dsaltares/fetch-gh-release-asset@master | ||
with: | ||
version: "tags/${{ github.event.release.tag_name }}" | ||
file: "${{ matrix.binary }}" | ||
target: "integritee-service" | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
build-args: BINARY_FILE=${{ matrix.binary }} | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
- name: Login to Dockerhub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
context: . | ||
tags: | | ||
integritee/${{ matrix.binary }}:${{ github.event.release.tag_name }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
FROM integritee/integritee-dev:0.1.9 | ||
LABEL maintainer="[email protected]" | ||
|
||
# By default we warp the service-dev | ||
ARG BINARY_FILE=integritee-service-dev | ||
|
||
RUN echo "Oh dang look at that ${BINARY_FILE}" | ||
|
||
COPY ${BINARY_FILE} /usr/local/bin | ||
RUN chmod +x /usr/local/bin/${BINARY_FILE} | ||
|
||
# checks | ||
RUN ldd /usr/local/bin/${BINARY_FILE} && \ | ||
/usr/local/bin/${BINARY_FILE} --version | ||
|
||
ENV entrypoint="/usr/local/bin/${BINARY_FILE}" | ||
|
||
ENTRYPOINT ${entrypoint} |