From d5b1818ab8ba1ac6e26abdf74889999c65639aa2 Mon Sep 17 00:00:00 2001 From: Alec Date: Mon, 15 Nov 2021 10:33:24 +0000 Subject: [PATCH 01/12] lets see what happens --- .github/workflows/docker.yaml | 40 +++++++++++++++++ Dockerfile | 85 +++-------------------------------- 2 files changed, 45 insertions(+), 80 deletions(-) create mode 100644 .github/workflows/docker.yaml diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 000000000..cfcec541a --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,40 @@ +name: docker build & publish + +on: + push: + # branches: + # - 'master' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + push: true + tags: wkd1/test:workflow-test + cache-from: type=gha + cache-to: type=gha,mode=max + - + # Temp fix + # https://github.com/docker/build-push-action/issues/252 + # https://github.com/moby/buildkit/issues/1896 + name: Move cache + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache diff --git a/Dockerfile b/Dockerfile index d91c4d403..d84b55e76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,80 +1,5 @@ - -# Build for raspberry pi -# docker buildx build --platform linux/arm/v7 --progress=plain -t theyosh/terrariumpi:4.0.0 -f Dockerfile --push . - -# build sispmctl 4.9 -FROM gcc:9.4.0-buster as sispmctl_builder -RUN apt-get update && apt-get install -y --no-install-recommends libusb-dev && \ - wget https://sourceforge.net/projects/sispmctl/files/sispmctl/sispmctl-4.9/sispmctl-4.9.tar.gz/download -O sispmctl-4.9.tar.gz && \ - tar zxvf sispmctl-4.9.tar.gz && \ - cd sispmctl-4.9/ && \ - ./configure && \ - make && \ - make install - -# python builder, help keep image small -FROM python:3.8.0 as builder -ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get install -y gnupg ca-certificates && \ - echo "deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi" > /etc/apt/sources.list.d/raspberrypi.list && \ - echo "deb http://archive.raspberrypi.org/debian/ buster main" >> /etc/apt/sources.list.d/raspberrypi.list && \ - echo "deb [arch=armhf] https://download.docker.com/linux/raspbian buster stable" > /etc/apt/sources.list.d/docker.list && \ - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E 82B129927FA3303E 7EA0A9C3F273FCD8 && \ - rm -rf /var/lib/apt/lists/* && \ - apt-get update && \ - apt-get install -y --no-install-recommends bc git watchdog i2c-tools pigpio sqlite3 ffmpeg sispmctl ntp libxslt1.1 libglib2.0-dev && \ - apt-get install -y --no-install-recommends libopenexr23 libilmbase23 liblapack3 libatlas3-base && \ - apt-get install -y --no-install-recommends python3-opencv libftdi1 libasound-dev -RUN python -m venv /opt/venv -ENV PATH="/opt/venv/bin:$PATH" -# rpi.gpio - https://askubuntu.com/questions/1290037/error-while-installing-rpi-gpio-as-error-command-errored-out-with-exit-status -ENV CFLAGS=-fcommon -# cryptography - https://stackoverflow.com/questions/66118337/how-to-get-rid-of-cryptography-build-error -ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1 -RUN pip install --upgrade pip && pip install wheel -COPY requirements.txt . -# requirements are slightly different for docker -RUN sed -i 's/cryptography/cryptography==3.4.6/g' requirements.txt && \ - sed -i 's/opencv-python-headless/# opencv-python-headless/g' requirements.txt && \ - echo "numpy" >> requirements.txt && \ - pip install -r requirements.txt -WORKDIR /TerrariumPI -COPY .git .git -RUN git submodule init && \ - git submodule update && \ - rm -rf .git - -# remove git dir from code copy to help keep image smaller -FROM python:3.8.0 as remove_git_dir -WORKDIR /TerrariumPI -COPY . . -RUN rm -rf .git - -# actual image -FROM python:3.8.0-slim-buster -ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get install -y --no-install-recommends gnupg ca-certificates && \ - echo "deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi" > /etc/apt/sources.list.d/raspberrypi.list && \ - echo "deb http://archive.raspberrypi.org/debian/ buster main" >> /etc/apt/sources.list.d/raspberrypi.list && \ - echo "deb [arch=armhf] https://download.docker.com/linux/raspbian buster stable" > /etc/apt/sources.list.d/docker.list && \ - apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E 82B129927FA3303E 7EA0A9C3F273FCD8 && \ - rm -rf /var/lib/apt/lists/* && \ - apt-get update && \ - apt-get install -y --no-install-recommends sudo bc watchdog i2c-tools pigpio sqlite3 ffmpeg sispmctl ntp libxslt1.1 && \ - apt-get install -y --no-install-recommends libopenexr23 libilmbase23 liblapack3 libatlas3-base && \ - apt-get install -y --no-install-recommends python3-opencv libftdi1 && \ - mkdir -p /usr/share/man/man1 && apt-get install -y --no-install-recommends openjdk-11-jre-headless && \ - apt-get autoremove -y && rm -rf /var/lib/apt/lists/* -COPY --from=sispmctl_builder /usr/local/lib/libsispmctl* /usr/local/lib/. -COPY --from=sispmctl_builder /usr/local/bin/sispmctl /usr/local/bin/sispmctl -RUN rm /usr/local/lib/libsispmctl.so /usr/local/lib/libsispmctl.so.0 && ln -s /usr/local/lib/libsispmctl.so.0.2.1 /usr/local/lib/libsispmctl.so && ln -s /usr/local/lib/libsispmctl.so.0.2.1 /usr/local/lib/libsispmctl.so.0 && \ - ldconfig -ENV PATH="/opt/venv/bin:$PATH" -COPY --from=builder /opt/venv /opt/venv -RUN ln -s /usr/lib/python3/dist-packages/cv2.cpython-37m-arm-linux-gnueabihf.so /opt/venv/lib/python3.8/site-packages/cv2.so && \ - mv /usr/lib/python3.7/gettext.py /usr/local/lib/python3.8/gettext.py && \ - rm -rf /usr/lib/python3/dist-packages/numpy /usr/lib/python3/dist-packages/numpy-1.16.2.egg-info -WORKDIR /TerrariumPI -COPY --from=builder /TerrariumPI/ /TerrariumPI/. -COPY --from=remove_git_dir /TerrariumPI /TerrariumPI -ENTRYPOINT ["/bin/bash", "/TerrariumPI/run.sh"] +# Temp small Dockerfile while testing workflow +# docker build -t wkd1/test:workflow-test . +# docker buildx build --platform linux/arm/v7 -t wkd1/test:workflow-test-arm . +FROM alpine:3.14.3 +RUN echo "hi" > /test.out From 6de90f5a19759d75236b1d21ffac50bfadf2093d Mon Sep 17 00:00:00 2001 From: Alec Date: Mon, 15 Nov 2021 10:38:08 +0000 Subject: [PATCH 02/12] build for armv7 and remove the move cache thing as it failed --- .github/workflows/docker.yaml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index cfcec541a..4738deb12 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -28,13 +28,6 @@ jobs: context: . push: true tags: wkd1/test:workflow-test + platforms: linux/arm/v7 cache-from: type=gha cache-to: type=gha,mode=max - - - # Temp fix - # https://github.com/docker/build-push-action/issues/252 - # https://github.com/moby/buildkit/issues/1896 - name: Move cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache From 6a33ca72c28c56cb4f1f040d50c2ca1317a850ed Mon Sep 17 00:00:00 2001 From: Alec Date: Mon, 15 Nov 2021 10:51:43 +0000 Subject: [PATCH 03/12] now time to try the real dockerfile --- Dockerfile | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 80 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index d84b55e76..d91c4d403 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,80 @@ -# Temp small Dockerfile while testing workflow -# docker build -t wkd1/test:workflow-test . -# docker buildx build --platform linux/arm/v7 -t wkd1/test:workflow-test-arm . -FROM alpine:3.14.3 -RUN echo "hi" > /test.out + +# Build for raspberry pi +# docker buildx build --platform linux/arm/v7 --progress=plain -t theyosh/terrariumpi:4.0.0 -f Dockerfile --push . + +# build sispmctl 4.9 +FROM gcc:9.4.0-buster as sispmctl_builder +RUN apt-get update && apt-get install -y --no-install-recommends libusb-dev && \ + wget https://sourceforge.net/projects/sispmctl/files/sispmctl/sispmctl-4.9/sispmctl-4.9.tar.gz/download -O sispmctl-4.9.tar.gz && \ + tar zxvf sispmctl-4.9.tar.gz && \ + cd sispmctl-4.9/ && \ + ./configure && \ + make && \ + make install + +# python builder, help keep image small +FROM python:3.8.0 as builder +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y gnupg ca-certificates && \ + echo "deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi" > /etc/apt/sources.list.d/raspberrypi.list && \ + echo "deb http://archive.raspberrypi.org/debian/ buster main" >> /etc/apt/sources.list.d/raspberrypi.list && \ + echo "deb [arch=armhf] https://download.docker.com/linux/raspbian buster stable" > /etc/apt/sources.list.d/docker.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E 82B129927FA3303E 7EA0A9C3F273FCD8 && \ + rm -rf /var/lib/apt/lists/* && \ + apt-get update && \ + apt-get install -y --no-install-recommends bc git watchdog i2c-tools pigpio sqlite3 ffmpeg sispmctl ntp libxslt1.1 libglib2.0-dev && \ + apt-get install -y --no-install-recommends libopenexr23 libilmbase23 liblapack3 libatlas3-base && \ + apt-get install -y --no-install-recommends python3-opencv libftdi1 libasound-dev +RUN python -m venv /opt/venv +ENV PATH="/opt/venv/bin:$PATH" +# rpi.gpio - https://askubuntu.com/questions/1290037/error-while-installing-rpi-gpio-as-error-command-errored-out-with-exit-status +ENV CFLAGS=-fcommon +# cryptography - https://stackoverflow.com/questions/66118337/how-to-get-rid-of-cryptography-build-error +ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1 +RUN pip install --upgrade pip && pip install wheel +COPY requirements.txt . +# requirements are slightly different for docker +RUN sed -i 's/cryptography/cryptography==3.4.6/g' requirements.txt && \ + sed -i 's/opencv-python-headless/# opencv-python-headless/g' requirements.txt && \ + echo "numpy" >> requirements.txt && \ + pip install -r requirements.txt +WORKDIR /TerrariumPI +COPY .git .git +RUN git submodule init && \ + git submodule update && \ + rm -rf .git + +# remove git dir from code copy to help keep image smaller +FROM python:3.8.0 as remove_git_dir +WORKDIR /TerrariumPI +COPY . . +RUN rm -rf .git + +# actual image +FROM python:3.8.0-slim-buster +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y --no-install-recommends gnupg ca-certificates && \ + echo "deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi" > /etc/apt/sources.list.d/raspberrypi.list && \ + echo "deb http://archive.raspberrypi.org/debian/ buster main" >> /etc/apt/sources.list.d/raspberrypi.list && \ + echo "deb [arch=armhf] https://download.docker.com/linux/raspbian buster stable" > /etc/apt/sources.list.d/docker.list && \ + apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E 82B129927FA3303E 7EA0A9C3F273FCD8 && \ + rm -rf /var/lib/apt/lists/* && \ + apt-get update && \ + apt-get install -y --no-install-recommends sudo bc watchdog i2c-tools pigpio sqlite3 ffmpeg sispmctl ntp libxslt1.1 && \ + apt-get install -y --no-install-recommends libopenexr23 libilmbase23 liblapack3 libatlas3-base && \ + apt-get install -y --no-install-recommends python3-opencv libftdi1 && \ + mkdir -p /usr/share/man/man1 && apt-get install -y --no-install-recommends openjdk-11-jre-headless && \ + apt-get autoremove -y && rm -rf /var/lib/apt/lists/* +COPY --from=sispmctl_builder /usr/local/lib/libsispmctl* /usr/local/lib/. +COPY --from=sispmctl_builder /usr/local/bin/sispmctl /usr/local/bin/sispmctl +RUN rm /usr/local/lib/libsispmctl.so /usr/local/lib/libsispmctl.so.0 && ln -s /usr/local/lib/libsispmctl.so.0.2.1 /usr/local/lib/libsispmctl.so && ln -s /usr/local/lib/libsispmctl.so.0.2.1 /usr/local/lib/libsispmctl.so.0 && \ + ldconfig +ENV PATH="/opt/venv/bin:$PATH" +COPY --from=builder /opt/venv /opt/venv +RUN ln -s /usr/lib/python3/dist-packages/cv2.cpython-37m-arm-linux-gnueabihf.so /opt/venv/lib/python3.8/site-packages/cv2.so && \ + mv /usr/lib/python3.7/gettext.py /usr/local/lib/python3.8/gettext.py && \ + rm -rf /usr/lib/python3/dist-packages/numpy /usr/lib/python3/dist-packages/numpy-1.16.2.egg-info +WORKDIR /TerrariumPI +COPY --from=builder /TerrariumPI/ /TerrariumPI/. +COPY --from=remove_git_dir /TerrariumPI /TerrariumPI +ENTRYPOINT ["/bin/bash", "/TerrariumPI/run.sh"] From effbdef34a2f76175d26ebc39419a389ca8cb122 Mon Sep 17 00:00:00 2001 From: Alec Date: Mon, 15 Nov 2021 11:10:19 +0000 Subject: [PATCH 04/12] attempting to fix `debconf: delaying package configuration, since apt-utils is not installed` --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index d91c4d403..173ab0d50 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends libusb-dev && \ # python builder, help keep image small FROM python:3.8.0 as builder ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y --no-install-recommends apt-utils RUN apt-get update && apt-get install -y gnupg ca-certificates && \ echo "deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi" > /etc/apt/sources.list.d/raspberrypi.list && \ echo "deb http://archive.raspberrypi.org/debian/ buster main" >> /etc/apt/sources.list.d/raspberrypi.list && \ From e35f6dd92b535b8916f39de85eab0660242c81a9 Mon Sep 17 00:00:00 2001 From: Alec Date: Mon, 15 Nov 2021 11:22:02 +0000 Subject: [PATCH 05/12] Ok think the runners hit the same issue as @theyosh on ubuntu --- .github/workflows/docker.yaml | 7 +++++++ Dockerfile | 1 - 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 4738deb12..131543e79 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -12,6 +12,13 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - + name: Set up QEMU + id: qemu + uses: docker/setup-qemu-action@v1 + with: + image: tonistiigi/binfmt:latest + platforms: arm - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 diff --git a/Dockerfile b/Dockerfile index 173ab0d50..d91c4d403 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends libusb-dev && \ # python builder, help keep image small FROM python:3.8.0 as builder ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get install -y --no-install-recommends apt-utils RUN apt-get update && apt-get install -y gnupg ca-certificates && \ echo "deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi" > /etc/apt/sources.list.d/raspberrypi.list && \ echo "deb http://archive.raspberrypi.org/debian/ buster main" >> /etc/apt/sources.list.d/raspberrypi.list && \ From 8a9220aa85282ef0faad4f0c6c528ed44e9d44a9 Mon Sep 17 00:00:00 2001 From: Alec Date: Mon, 15 Nov 2021 13:52:17 +0000 Subject: [PATCH 06/12] checking to see if docker cache works --- run.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/run.sh b/run.sh index f81707189..db5363eac 100644 --- a/run.sh +++ b/run.sh @@ -100,3 +100,5 @@ pigpiod -l # No reboot required, Pi must already be fully configured, start TP exec /opt/venv/bin/python /TerrariumPI/terrariumPI.py + +# test pretend code change From de3a06d2e58a01ebc8a0fc88f38fb80fd32fe453 Mon Sep 17 00:00:00 2001 From: Alec Date: Mon, 15 Nov 2021 14:23:55 +0000 Subject: [PATCH 07/12] slight improvement to caching to help speed up future workflows --- Dockerfile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index d91c4d403..55664d2c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,10 +39,17 @@ RUN sed -i 's/cryptography/cryptography==3.4.6/g' requirements.txt && \ echo "numpy" >> requirements.txt && \ pip install -r requirements.txt WORKDIR /TerrariumPI -COPY .git .git -RUN git submodule init && \ - git submodule update && \ - rm -rf .git +# we previously copied .git and then did git submodule init and submodule update, however as .git dir changes all the time it invalidates docker cache +RUN mkdir 3rdparty && cd 3rdparty && \ + git clone https://github.com/SequentMicrosystems/4relay-rpi.git && git -C "4relay-rpi" checkout "09a44bfbde18791750534ba204e1dfc7506a7eb2" && \ + git clone https://github.com/PiSupply/Bright-Pi.git && git -C "Bright-Pi" checkout "eccfbbb1221c4966cd337126bedcbb8bb03c3c71" && \ + git clone https://github.com/ageir/chirp-rpi.git && git -C "chirp-rpi" checkout "6e411d6c382d5e43ee1fd269ec4de6a316893407" && \ + git clone https://github.com/perryflynn/energenie-connect0r.git && git -C "energenie-connect0r" checkout "12ca24ab9d60cf4ede331de9a6817c3d64227ea0" && \ + git clone https://github.com/SequentMicrosystems/relay8-rpi.git && git -C "relay8-rpi" checkout "5083730e415ee91fa4785e228f02a36e8bbaa717" +RUN mkdir -p static/assets/plguins && cd static/assets/plguins && \ + git clone https://github.com/fancyapps/fancybox.git && git -C "fancybox" checkout "eea1345256ded510ed9fae1e415aec2a7bb9620d" && \ + git clone https://github.com/mapshakers/leaflet-icon-pulse.git && git -C "leaflet-icon-pulse" checkout "f57da1e45f6d00f340f429a75a39324cad141061" && \ + git clone https://github.com/ebrelsford/Leaflet.loading.git && git -C "Leaflet.loading" checkout "7b22aff19a5a8fa9534fb2dcd48e06c6dc84b2ed" # remove git dir from code copy to help keep image smaller FROM python:3.8.0 as remove_git_dir From ed84cddf0d5f6d0bae51ecad70db815733a72448 Mon Sep 17 00:00:00 2001 From: Alec Date: Mon, 15 Nov 2021 14:27:29 +0000 Subject: [PATCH 08/12] test improvement --- run.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/run.sh b/run.sh index db5363eac..f81707189 100644 --- a/run.sh +++ b/run.sh @@ -100,5 +100,3 @@ pigpiod -l # No reboot required, Pi must already be fully configured, start TP exec /opt/venv/bin/python /TerrariumPI/terrariumPI.py - -# test pretend code change From 372b513b1ca340af2b8be30da420cc296e7c7c6d Mon Sep 17 00:00:00 2001 From: Alec Date: Mon, 15 Nov 2021 15:13:46 +0000 Subject: [PATCH 09/12] don't build docker image if updating docs --- .github/workflows/docker.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 131543e79..f282d6088 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -2,8 +2,8 @@ name: docker build & publish on: push: - # branches: - # - 'master' + paths-ignore: + - 'docs/**' jobs: docker: From 8d16cfe11abd7dd740043e4f784ab189047c305c Mon Sep 17 00:00:00 2001 From: Alec Date: Tue, 16 Nov 2021 09:33:13 +0000 Subject: [PATCH 10/12] updated workflow --- .github/workflows/docker.yaml | 39 ++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index f282d6088..b4ed62ca1 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -1,7 +1,14 @@ +# Runs on PR or Release and only if Dockerfile exists and not docs being updated name: docker build & publish on: + pull_request: + paths-ignore: + - 'docs/**' push: + branches: + - 'master' + tags: paths-ignore: - 'docs/**' @@ -12,8 +19,15 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - + name: Check Dockerfile exists + id: dockerfile + uses: andstor/file-existence-action@v1 + with: + files: "Dockerfile" - name: Set up QEMU + if: steps.Dockerfile.outputs.files_exists == 'true' id: qemu uses: docker/setup-qemu-action@v1 with: @@ -21,20 +35,43 @@ jobs: platforms: arm - name: Set up Docker Buildx + if: steps.Dockerfile.outputs.files_exists == 'true' uses: docker/setup-buildx-action@v1 + - + name: Docker meta + if: steps.Dockerfile.outputs.files_exists == 'true' + id: meta + uses: docker/metadata-action@v3 + with: + images: theyosh/terrariumpi - name: Login to DockerHub + if: steps.Dockerfile.outputs.files_exists == 'true' uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build + if: steps.Dockerfile.outputs.files_exists == 'true' + uses: docker/build-push-action@v2 + with: + context: . + push: false + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/arm/v7 + cache-from: type=gha + cache-to: type=gha,mode=max - name: Build and push + if: steps.Dockerfile.outputs.files_exists == 'true' && GitHub.event_name == 'release' uses: docker/build-push-action@v2 with: context: . push: true - tags: wkd1/test:workflow-test + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} platforms: linux/arm/v7 cache-from: type=gha cache-to: type=gha,mode=max From 3b09867c568d670f7aa668092df0e79dc6216bcd Mon Sep 17 00:00:00 2001 From: Alec Date: Tue, 16 Nov 2021 12:18:14 +0000 Subject: [PATCH 11/12] interested to see what tags get added --- .github/workflows/docker.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index b4ed62ca1..c99097e5f 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -43,7 +43,7 @@ jobs: id: meta uses: docker/metadata-action@v3 with: - images: theyosh/terrariumpi + images: wkd1/test - name: Login to DockerHub if: steps.Dockerfile.outputs.files_exists == 'true' @@ -57,7 +57,7 @@ jobs: uses: docker/build-push-action@v2 with: context: . - push: false + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} platforms: linux/arm/v7 From 9bf60882f33e7320b9cd92b23fbc1808115e6601 Mon Sep 17 00:00:00 2001 From: Alec Date: Thu, 18 Nov 2021 11:40:01 +0000 Subject: [PATCH 12/12] no longer runs on PR and set updated image path --- .github/workflows/docker.yaml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index c99097e5f..ef4955462 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -2,9 +2,6 @@ name: docker build & publish on: - pull_request: - paths-ignore: - - 'docs/**' push: branches: - 'master' @@ -43,7 +40,7 @@ jobs: id: meta uses: docker/metadata-action@v3 with: - images: wkd1/test + images: theyosh/terrariumpi - name: Login to DockerHub if: steps.Dockerfile.outputs.files_exists == 'true' @@ -51,21 +48,9 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Build - if: steps.Dockerfile.outputs.files_exists == 'true' - uses: docker/build-push-action@v2 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - platforms: linux/arm/v7 - cache-from: type=gha - cache-to: type=gha,mode=max - name: Build and push - if: steps.Dockerfile.outputs.files_exists == 'true' && GitHub.event_name == 'release' + if: steps.Dockerfile.outputs.files_exists == 'true' uses: docker/build-push-action@v2 with: context: .