From 32264ab0b9fde9f62e7ca31f6ee62525cf1012a3 Mon Sep 17 00:00:00 2001 From: Rhodri <24809571+rhld16@users.noreply.github.com> Date: Mon, 24 Jan 2022 18:51:21 +0000 Subject: [PATCH 1/2] Use GitHub Actions for CI --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1787a70 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: ci + +on: + push: + branches: + - 'master' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Login to DockerHub + if: github.event_name != 'pull_request' + 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: ${{ github.event_name != 'pull_request' }} + tags: ${{ secrets.DOCKERHUB_USERNAME }}/zoffline:latest \ No newline at end of file From 0424bf9caf76b1a2689e9d53b8f86fd6f8ee4afc Mon Sep 17 00:00:00 2001 From: rhld16 <24809571+rhld16@users.noreply.github.com> Date: Mon, 24 Jan 2022 23:15:40 +0000 Subject: [PATCH 2/2] reduce docker image size --- Dockerfile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index aabb926..3d9fcfe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,21 @@ +FROM python:3-alpine as builder + +WORKDIR /usr/src/app + +RUN apk add --no-cache git gcc g++ musl-dev libffi-dev openssl-dev file make +RUN pip install --user flask flask_sqlalchemy flask-login pyjwt gevent protobuf protobuf3_to_dict stravalib garmin-uploader requests + +RUN git clone --depth 1 https://github.com/zoffline/zwift-offline + FROM python:3-alpine MAINTAINER zoffline WORKDIR /usr/src/app -RUN apk add --no-cache git gcc g++ musl-dev libffi-dev openssl-dev file make -RUN pip install flask flask_sqlalchemy flask-login pyjwt gevent protobuf protobuf3_to_dict stravalib garmin-uploader requests +COPY --from=builder /root/.local/ /root/.local/ +ENV PATH=/root/.local/bin:$PATH -RUN git clone --depth 1 https://github.com/zoffline/zwift-offline +COPY --from=builder /usr/src/app/zwift-offline/ zwift-offline/ RUN chmod 777 zwift-offline/storage EXPOSE 443 80 3022/udp 3023