From 94a77f55b64628bacb1c2b54c894667d5eb79e1a Mon Sep 17 00:00:00 2001 From: Wolfgang Welz <welzwo@gmail.com> Date: Mon, 29 Jun 2020 22:05:37 +0200 Subject: [PATCH] Automatically publish Docker images (#581) * publish docker image on release * switch to iotaledger/goshimmer * copy snapshot file into docker image * copy config file to docker image * use fixed docker/build-push-action --- .github/workflows/develop.yml | 18 +++++++++++++ .github/workflows/docker.yml | 23 ---------------- .github/workflows/release.yml | 51 ++++++++++++++++++++++------------- Dockerfile | 6 ++++- 4 files changed, 56 insertions(+), 42 deletions(-) create mode 100644 .github/workflows/develop.yml delete mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml new file mode 100644 index 00000000..9fe0739f --- /dev/null +++ b/.github/workflows/develop.yml @@ -0,0 +1,18 @@ +name: Develop +'on': + push: + branches: + - develop +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Publish to Docker Hub + uses: docker/build-push-action@92e71463491f2d026a477188b8ad3a0fdd9d672c + with: + repository: iotaledger/goshimmer + username: '${{ secrets.IOTALEDGER_HUB_DOCKER_LOGIN }}' + password: '${{ secrets.IOTALEDGER_HUB_DOCKER_PASSWORD }}' + tags: develop diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 8d197c2f..00000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Publish Docker develop - -on: - push: - branches: - - develop - -jobs: - - build: - runs-on: ubuntu-latest - steps: - - - name: Check out code - uses: actions/checkout@master - - - name: Publish to registry - uses: elgohr/Publish-Docker-Github-Action@master - with: - name: iotagoshimmer/goshimmer - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - tags: "develop" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 37fc37fe..f69e0600 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,23 +1,38 @@ name: Release - -on: +'on': release: - types: [published] - + types: + - published jobs: - Release: - name: Release - runs-on: [ubuntu-latest] + goreleaser: + name: GoReleaser + runs-on: + - ubuntu-latest container: - image: iotmod/goreleaser-cgo-cross-compiler:1.14.4 - volumes: [/repo] - + image: 'iotmod/goreleaser-cgo-cross-compiler:1.14.4' + volumes: + - /repo steps: - - name: Check out code into the Go module directory - uses: actions/checkout@v2 - - name: Copy config.default.json to config.json - run: cp config.default.json config.json - - name: Release GoShimmer - run: goreleaser --rm-dist - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout + uses: actions/checkout@v2 + - name: Copy config.default.json to config.json + run: cp config.default.json config.json + - name: Release GoShimmer + run: goreleaser --rm-dist + env: + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' + docker: + name: Docker + runs-on: + - ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Publish to Docker Hub + uses: docker/build-push-action@92e71463491f2d026a477188b8ad3a0fdd9d672c + with: + repository: iotaledger/goshimmer + username: '${{ secrets.IOTALEDGER_HUB_DOCKER_LOGIN }}' + password: '${{ secrets.IOTALEDGER_HUB_DOCKER_PASSWORD }}' + tags: latest + tag_with_ref: true diff --git a/Dockerfile b/Dockerfile index 2048c32b..42320aae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,11 @@ FROM gcr.io/distroless/static@sha256:23aa732bba4c8618c0d97c26a72a32997363d591807 EXPOSE 14666/tcp EXPOSE 14626/udp +# Copy configuration +COPY snapshot.bin /snapshot.bin +COPY config.default.json /config.json + # Copy the Pre-built binary file from the previous stage COPY --from=build /go/bin/goshimmer /run/goshimmer -ENTRYPOINT ["/run/goshimmer", "--config-dir=/", "--database.directory=/tmp/mainnetdb"] +ENTRYPOINT ["/run/goshimmer", "--config-dir=/", "--valueLayer.snapshot.file=/snapshot.bin", "--database.directory=/tmp/mainnetdb"] -- GitLab