Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply image template first alpha(s) #40

Merged
merged 1 commit into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .copier-answers.image-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Changes here will be overwritten by Copier; do NOT edit manually
_commit: v0.1.2
_src_path: https://github.com/Tecnativa/image-template.git
dockerhub_image: tecnativa/docker-socket-proxy
image_platforms:
- linux/386
- linux/amd64
- linux/arm/v6
- linux/arm/v7
- linux/arm/v8
- linux/arm64
- linux/ppc64le
- linux/s390x
main_branches:
- master
project_name: docker-socket-proxy
project_owner: Tecnativa
push_to_ghcr: true
pytest: true
python_versions:
- "3.8"
164 changes: 164 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
name: Build, Test & Deploy

"on":
pull_request:
push:
branches:
- master
workflow_dispatch:
inputs:
pytest_addopts:
description:
Extra options for pytest; use -vv for full details; see
https://docs.pytest.org/en/latest/example/simple.html#how-to-change-command-line-options-defaults
required: false

env:
LANG: "en_US.utf-8"
LC_ALL: "en_US.utf-8"
PIP_CACHE_DIR: ${{ github.workspace }}/.cache.~/pip
PIPX_HOME: ${{ github.workspace }}/.cache.~/pipx
POETRY_CACHE_DIR: ${{ github.workspace }}/.cache.~/pypoetry
POETRY_VIRTUALENVS_IN_PROJECT: "true"
PYTEST_ADDOPTS: ${{ github.event.inputs.pytest_addopts }}
PYTHONIOENCODING: "UTF-8"

jobs:
build-test:
runs-on: ubuntu-20.04
strategy:
matrix:
python:
- 3.8
steps:
# Prepare environment
- uses: actions/checkout@v2
# Set up and run tests
- name: Install python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- name: Generate cache key CACHE
run:
echo "CACHE=${{ secrets.CACHE_DATE }} ${{ runner.os }} $(python -VV |
sha256sum | cut -d' ' -f1) ${{ hashFiles('pyproject.toml') }} ${{
hashFiles('poetry.lock') }}" >> $GITHUB_ENV
- uses: actions/cache@v2
with:
path: |
.cache.~
.venv
~/.local/bin
key: venv ${{ env.CACHE }}
- run: pip install poetry
- name: Patch $PATH
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- run: poetry install
# Run tests
- run: poetry run pytest --prebuild
build-push:
runs-on: ubuntu-20.04
services:
registry:
image: registry:2
ports:
- 5000:5000
env:
DOCKER_IMAGE_NAME: ${{ github.repository }}
DOCKERHUB_IMAGE_NAME: tecnativa/docker-socket-proxy
PUSH: ${{ toJSON(github.event_name != 'pull_request') }}
steps:
# Set up Docker Environment
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
/tmp/.buildx-cache
key: buildx|${{ secrets.CACHE_DATE }}|${{ runner.os }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
with:
driver-opts: network=host
install: true
# Build and push
- name: Docker meta for local images
id: docker_meta_local
uses: crazy-max/ghaction-docker-meta@v1
with:
images: localhost:5000/${{ env.DOCKER_IMAGE_NAME }}
tag-edge: true
tag-semver: |
{{version}}
{{major}}
{{major}}.{{minor}}
- name: Build and push to local (test) registry
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: |
linux/386
linux/amd64
linux/arm/v6
linux/arm/v7
linux/arm/v8
linux/arm64
linux/ppc64le
linux/s390x
load: false
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
labels: ${{ steps.docker_meta_local.outputs.labels }}
tags: ${{ steps.docker_meta_local.outputs.tags }}
# Next jobs only happen outside of pull requests and on main branches
- name: Login to DockerHub
if: ${{ fromJSON(env.PUSH) }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_LOGIN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
if: ${{ fromJSON(env.PUSH) }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.BOT_LOGIN }}
password: ${{ secrets.BOT_TOKEN }}
- name: Docker meta for public images
if: ${{ fromJSON(env.PUSH) }}
id: docker_meta_public
uses: crazy-max/ghaction-docker-meta@v1
with:
images: |
ghcr.io/${{ env.DOCKER_IMAGE_NAME }}
${{ env.DOCKERHUB_IMAGE_NAME }}
tag-edge: true
tag-semver: |
{{version}}
{{major}}
{{major}}.{{minor}}
- name: Build and push to public registry(s)
if: ${{ fromJSON(env.PUSH) }}
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
platforms: |
linux/386
linux/amd64
linux/arm/v6
linux/arm/v7
linux/arm/v8
linux/arm64
linux/ppc64le
linux/s390x
load: false
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
labels: ${{ steps.docker_meta_public.outputs.labels }}
tags: ${{ steps.docker_meta_public.outputs.tags }}
111 changes: 0 additions & 111 deletions .github/workflows/test.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[![Last image-template](https://img.shields.io/badge/last%20template%20update-v0.1.2-informational)](https://github.com/Tecnativa/image-template/tree/v0.1.2)
[![GitHub Container Registry](https://img.shields.io/badge/GitHub%20Container%20Registry-latest-%2324292e)](https://github.com/orgs/Tecnativa/packages/container/package/docker-socket-proxy)
[![Docker Hub](https://img.shields.io/badge/Docker%20Hub-latest-%23099cec)](https://hub.docker.com/r/tecnativa/docker-socket-proxy)

# Docker Socket Proxy

[![Docker Hub](https://img.shields.io/badge/Docker%20Hub-docker.io%2Ftecnativa%2Fdocker--socket--proxy-%23099cec)](https://hub.docker.com/r/tecnativa/docker-socket-proxy)
Expand Down
Loading