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
This commit is contained in:
Jonathan Zernik 2021-01-03 21:00:49 -08:00 committed by GitHub
parent d341d3cbc0
commit f263dd60dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 65 additions and 3 deletions

62
.github/workflows/main.yml vendored Normal file
View file

@ -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 }}

View file

@ -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

View file

@ -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

View file

@ -86,7 +86,7 @@ setup(
'importlib_resources',
'argparse',
'googleapis-common-protos',
'grpcio',
'grpcio>=1.34.0',
'grpcio-tools',
'mypy-protobuf',
'psycopg2',