From f52d09cf613862a6569c85cf8f45dd823d2f82e6 Mon Sep 17 00:00:00 2001 From: Mike Keller Date: Tue, 23 Feb 2021 11:53:18 -0800 Subject: [PATCH] Automated Image Updates (#17) * Adds initial workflow file for automatically keeping container images up to date. * TODO: Still requires testing for the cron schedule to ensure that it is working appropriately. --- .github/workflows/update-image.yml | 31 +++++++++++++++ Dockerfile.bak | 59 +++++++++++++++++++++++++++++ Dockerfile.testing | 3 ++ hello | Bin 0 -> 13336 bytes 4 files changed, 93 insertions(+) create mode 100644 .github/workflows/update-image.yml create mode 100644 Dockerfile.bak create mode 100644 Dockerfile.testing create mode 100644 hello diff --git a/.github/workflows/update-image.yml b/.github/workflows/update-image.yml new file mode 100644 index 0000000..37320cd --- /dev/null +++ b/.github/workflows/update-image.yml @@ -0,0 +1,31 @@ +name: "Update Image" +on: + # TODO: Remove faster schedule and pull_request once testing is completed. + schedule: # Schedled workflows only run once merged into main. + - cron: "*/5 * * * *" # Faster schedule for testing. + #- cron: "0 12 * * *" # Proposed schedule once testing has completed. + pull_request: # Here to ensure the workflow runs during testing. Will be removed once testing is completed. + types: [opened, reopened, synchronize] +jobs: + rebuild-container: + name: "Rebuild Container" + runs-on: ubuntu-latest + steps: + # Checkout the repo. + - name: "Checkout" + uses: "actions/checkout@v2" + + # Build and push the repo. + - name: "Build and Push" + uses: docker/build-push-action@v1 + with: + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: docker.pkg.github.com + repository: ${{ github.repository }}/simple-monerod + tags: latest + # TODO: Test that a release tag stays assigned to the rebuilt container when release tagged. + tag_with_ref: true + # TODO: Evaluate if the following are necessary. + add_git_labels: true + tag_with_sha: true \ No newline at end of file diff --git a/Dockerfile.bak b/Dockerfile.bak new file mode 100644 index 0000000..3b69b27 --- /dev/null +++ b/Dockerfile.bak @@ -0,0 +1,59 @@ +# From https://github.com/leonardochaia/docker-monerod/blob/master/src/Dockerfile +ARG MONERO_BRANCH=v0.17.1.9 + +# Select Ubuntu 20.04LTS for the build image base +FROM ubuntu:20.04 as build +LABEL author="sethsimmons@pm.me" \ + maintainer="sethsimmons@pm.me" + +# Dependency list from https://github.com/monero-project/monero#compiling-monero-from-source +# Added DEBIAN_FRONTEND=noninteractive to workaround tzdata prompt on installation +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends build-essential cmake \ + pkg-config libboost-all-dev libssl-dev libzmq3-dev libunbound-dev ca-certificates \ + libsodium-dev libunwind8-dev liblzma-dev libreadline6-dev libldns-dev \ + libexpat1-dev doxygen graphviz libpgm-dev qttools5-dev-tools libhidapi-dev \ + libusb-dev libprotobuf-dev protobuf-compiler libgtest-dev git \ + libnorm-dev libpgm-dev libusb-1.0-0-dev libudev-dev libgssapi-krb5-2 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Switch to directory for gtest and make/install libs +WORKDIR /usr/src/gtest +RUN cmake . && make && cp ./lib/libgtest*.a /usr/lib + +# Switch to Monero source directory +WORKDIR /monero + +# Git pull Monero source at specified tag/branch +ARG MONERO_BRANCH +RUN git clone --recursive --branch ${MONERO_BRANCH} \ + https://github.com/monero-project/monero . \ + && git submodule init && git submodule update + +# Make static Monero binaries +RUN make -j4 release-static + +# Select Ubuntu 20.04LTS for the image base +FROM ubuntu:20.04 + +# Install remaining dependencies +RUN apt-get update && apt-get install --no-install-recommends -y libnorm-dev libpgm-dev libgssapi-krb5-2 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Add user and setup directories for monerod +RUN useradd -ms /bin/bash monero && mkdir -p /home/monero/.bitmonero \ + && chown -R monero:monero /home/monero/.bitmonero +USER monero + +# Switch to home directory and install newly built monerod binary +WORKDIR /home/monero +COPY --chown=monero:monero --from=build /monero/build/Linux/*/release/bin/monerod /usr/local/bin/monerod + +# Expose p2p and restricted RPC ports +EXPOSE 18080 +EXPOSE 18089 + +# Start monerod with required --non-interactive flag and sane defaults that are overridden by user input (if applicable) +ENTRYPOINT ["monerod", "--non-interactive"] +CMD ["--rpc-restricted-bind-ip=0.0.0.0", "--rpc-restricted-bind-port=18089", "--no-igd", "--no-zmq", "--enable-dns-blocklist"] \ No newline at end of file diff --git a/Dockerfile.testing b/Dockerfile.testing new file mode 100644 index 0000000..a49c427 --- /dev/null +++ b/Dockerfile.testing @@ -0,0 +1,3 @@ +FROM scratch +COPY hello / +CMD ["/hello"] \ No newline at end of file diff --git a/hello b/hello new file mode 100644 index 0000000000000000000000000000000000000000..5052f25bc5c6f3f56e3795d8bee963a28b06e5b3 GIT binary patch literal 13336 zcmeHOeQX=$89z6@#&tj9iWV#};BC2T0a_<6WoxGfY;ek($)TZ1w5p*i7yA-h^+$BR zOVW)&yGx|K+`O@Wrb*L2B-kXzKhuP^(xKL^p>8_~L9|JMZlfA7+_^2;%K8bpJ(wU;I>OV(S8*PjJTq;eG+RzF?G#?5iOBpq;ahY?II| zM1|$TGH$zYUInwL!`Zavgm$SAwACmUaq94blh38MHrsYCb?wlP=OeaWAW?hb&}@^< zy0p=65vXcyw!Zd2luul`#TE;%FK{MKU6>0$$DMT?_eHsZO9|%$!KHqOfAl>qh50_~ zaADXEewgn+)fsXEy3{F)*N8C?(}y4F$G(&?j;nXvJmMkXA>bk4A>bk4A>bk4A>bk4 zA>bk4A@F~SK+lfKCst04vmy3`w6wMn4$`%DxJ1geRv;z{WjNCI(9)`7ErRgU=ehC_ zo-hyNrM8v}c2;QQ9A)p*(tSVq;IKuFcV}vtf|kDGr{)(sBPY75<T5}!u0`Lec(R?FOfvaBt(PPg2#54nm%!CvO}_w7V-*DO6U z+eFz6JyLss`i{{zX0??K0sPkKp_V)1^ZxrfHiMs_xAjw_wk+$IxB~2ayWG4kJ@a)?R(dJB8Y#b&K==J;djJhudO{)>UVzj)qEUz$jFhRl z^eDB;bn=A$AuTODN}2dtJ6M__I(Z6~XVf$$a6WlaznPjZN+Di?xNQZO(U$lOR6?d_uvP&;KCsCDe= zt=2?YTePK3|402CFS_2D-Tamjz-g=$<1LRrEA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