|
|
|
@ -24,11 +24,27 @@ env:
|
|
|
|
|
PYTHONIOENCODING: "UTF-8"
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
test:
|
|
|
|
|
build-test-push:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
env:
|
|
|
|
|
DOCKER_REPO: tecnativa/docker-socket-proxy
|
|
|
|
|
steps:
|
|
|
|
|
# Shared steps
|
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
|
# Prepare Docker environment and build
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
- uses: docker/setup-qemu-action@v1
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
- name: Build image(s)
|
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
|
with:
|
|
|
|
|
context: .
|
|
|
|
|
file: ./Dockerfile
|
|
|
|
|
# HACK: Build single platform image for testing. See https://github.com/docker/buildx/issues/59
|
|
|
|
|
load: true
|
|
|
|
|
push: false
|
|
|
|
|
tags: |
|
|
|
|
|
${{ env.DOCKER_REPO }}:local
|
|
|
|
|
# Set up and run tests
|
|
|
|
|
- name: Install python
|
|
|
|
|
uses: actions/setup-python@v1
|
|
|
|
|
with:
|
|
|
|
@ -51,30 +67,28 @@ jobs:
|
|
|
|
|
- run: poetry install
|
|
|
|
|
# Run tests
|
|
|
|
|
- run: poetry run pytest
|
|
|
|
|
build-push:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
needs: test
|
|
|
|
|
env:
|
|
|
|
|
DOCKER_REPO: tecnativa/docker-socket-proxy
|
|
|
|
|
steps:
|
|
|
|
|
# Prepare
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
- uses: docker/setup-qemu-action@v1
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
# Build and push
|
|
|
|
|
- name: Login to DockerHub
|
|
|
|
|
if:
|
|
|
|
|
github.repository == 'Tecnativa/docker-socket-proxy' && github.ref ==
|
|
|
|
|
'refs/heads/master'
|
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
|
with:
|
|
|
|
|
username: ${{ secrets.DOCKERHUB_LOGIN }}
|
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
- name: Login to GitHub Container Registry
|
|
|
|
|
if:
|
|
|
|
|
github.repository == 'Tecnativa/docker-socket-proxy' && github.ref ==
|
|
|
|
|
'refs/heads/master'
|
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
|
with:
|
|
|
|
|
registry: ghcr.io
|
|
|
|
|
username: ${{ secrets.BOT_LOGIN }}
|
|
|
|
|
password: ${{ secrets.BOT_TOKEN }}
|
|
|
|
|
- name: Build and push
|
|
|
|
|
if:
|
|
|
|
|
github.repository == 'Tecnativa/docker-socket-proxy' && github.ref ==
|
|
|
|
|
'refs/heads/master'
|
|
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
|
with:
|
|
|
|
|
context: .
|
|
|
|
|