From f263dd60ddae3b6777ae90c2a7e2c15b193e7a52 Mon Sep 17 00:00:00 2001 From: Jonathan Zernik Date: Sun, 3 Jan 2021 21:00:49 -0800 Subject: [PATCH] Create main.yml (#554) * Create main.yml Add the yaml file for the github action * Update main.yml Try build and push docker image * Update main.yml Fix image tag * Update main.yml Specify platforms in docker build action * Upgrade pip in dockerfile * Pin version of grpcio in requirements.txt * Install pip requirements with only-binary * Change grpcio version * Remove only-binary option for pip install * Update main.yml cache docker layers * Update main.yml Push version tags to dockerhub * Update main.yml export and import cache to local * Update main.yml Fix image name --- .github/workflows/main.yml | 62 ++++++++++++++++++++++++++++++++++++++ Dockerfile | 2 +- requirements.txt | 2 +- setup.py | 2 +- 4 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..9472f6bf --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,62 @@ +# This is a basic workflow to help you get started with Actions + +name: CI + +on: + schedule: + - cron: '0 10 * * *' # everyday at 10am + push: + branches: + - '**' + tags: + - 'v*.*.*' + pull_request: + +jobs: + main: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v2 + - + name: Docker meta + id: docker_meta + uses: crazy-max/ghaction-docker-meta@v1 + with: + images: yzernik/squeaknode + tag-sha: true # add git short SHA as Docker tag + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - + 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.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + platforms: linux/arm64,linux/amd64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.docker_meta.outputs.tags }} + labels: ${{ steps.docker_meta.outputs.labels }} + 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 }} diff --git a/Dockerfile b/Dockerfile index 5532c68f..922a6d37 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ ENV PATH="/opt/venv/bin:$PATH" COPY requirements.txt / -RUN pip install psycopg2 && \ +RUN pip install --upgrade pip && \ pip install -r requirements.txt WORKDIR /app diff --git a/requirements.txt b/requirements.txt index 2959482a..cdde33ef 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,7 +5,7 @@ flask-cors flask-login Flask-WTF googleapis-common-protos -grpcio +grpcio==1.34.0 grpcio-tools importlib_resources==1.4.0 mypy-protobuf diff --git a/setup.py b/setup.py index ab087941..bbfe041e 100644 --- a/setup.py +++ b/setup.py @@ -86,7 +86,7 @@ setup( 'importlib_resources', 'argparse', 'googleapis-common-protos', - 'grpcio', + 'grpcio>=1.34.0', 'grpcio-tools', 'mypy-protobuf', 'psycopg2',