Build docker image to generate protoc (#72)

This commit is contained in:
Jesse Hills 2021-07-22 11:35:08 +12:00 committed by GitHub
parent 2ec375af36
commit 7ce73f0dc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 170 additions and 0 deletions

96
.dockerignore Normal file
View File

@ -0,0 +1,96 @@
# Hide sublime text stuff
*.sublime-project
*.sublime-workspace
# Hide some OS X stuff
.DS_Store
.AppleDouble
.LSOverride
Icon
# Thumbnails
._*
# IntelliJ IDEA
.idea
*.iml
# pytest
.pytest_cache
.cache
# GITHUB Proposed Python stuff:
*.py[cod]
# C extensions
*.so
# Packages
*.egg
*.egg-info
dist
build
eggs
.eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
# Logs
*.log
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
htmlcov/
# Translations
*.mo
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
.python-version
# emacs auto backups
*~
*#
*.orig
# venv stuff
pyvenv.cfg
pip-selfcheck.json
venv
.venv
Pipfile*
share/*
# vimmy stuff
*.swp
*.swo
ctags.tmp
# Visual Studio Code
.vscode
# Built docs
docs/build
# Windows Explorer
desktop.ini
/.vs/*
# mypy
/.mypy_cache/*
.git*

View File

@ -4,3 +4,7 @@ updates:
directory: "/"
schedule:
interval: "daily"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

49
.github/workflows/docker.yml vendored Normal file
View File

@ -0,0 +1,49 @@
name: Build docker image on changes
on:
push:
branches:
- main
paths:
- Dockerfile
- requirements_test.txt
jobs:
build-image:
runs-on: ubuntu-latest
name: Build and push Docker image
steps:
-
name: Checkout source code
uses: actions/checkout@v2.3.4
-
name: Log in to docker hub
uses: docker/login-action@v1.10.0
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Log in to the GitHub container registry
uses: docker/login-action@v1.10.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1.2.0
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1.5.1
-
name: Build and Push
uses: docker/build-push-action@v2.6.1
with:
context: .
tags: |
ghcr.io/esphome/aioesphomeapi-proto-builder:latest
esphome/aioesphomeapi-proto-builder:latest
push: true
pull: true
platforms: linux/amd64,linux/arm64,linux/arm/v7

21
Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM python:3.9
RUN apt-get update && \
apt-get install -y protobuf-compiler
WORKDIR /aioesphomeapi
COPY requirements_test.txt ./
RUN pip3 install -r requirements_test.txt
CMD ["script/gen-protoc"]
LABEL \
org.opencontainers.image.title="aioesphomeapi protobuf generator" \
org.opencontainers.image.description="An image to help with ESPHomes aioesphomeapi protobuf generation" \
org.opencontainers.image.vendor="ESPHome" \
org.opencontainers.image.licenses="MIT" \
org.opencontainers.image.url="https://esphome.io" \
org.opencontainers.image.source="https://github.com/esphome/aioesphomeapi" \
org.opencontainers.image.documentation="https://github.com/esphome/aioesphomeapi/blob/main/README.md"