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

Feature/multi arch docker #48

Merged
merged 21 commits into from
Nov 24, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Docker Image CI

on:
push:
branches: [ master ]
pull_request:

jobs:

build:
strategy:
matrix:
arch: [amd64, arm64]
fail-fast: false

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Install build essentials
run: sudo apt-get install build-essential
- name: Install arm64 build support
run: sudo apt-get install qemu binfmt-support qemu-user-static
- name: Build the Docker image
run: docker build . --file ${{ matrix.arch }}.dockerfile --tag segelzwerg/family-foto:${{ matrix.arch }}
10 changes: 10 additions & 0 deletions amd64.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.9-buster
COPY ./requirements.txt requirements.txt
RUN apt-get update
RUN apt-get install -y libgl1-mesa-dev
RUN pip install -r requirements.txt
WORKDIR /app
ENV FLASK_APP family_foto
ENV FLASK_RUN_HOST 0.0.0.0
COPY . .
CMD ["flask", "run"]
16 changes: 16 additions & 0 deletions arm64.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu

FROM arm64v8/python:3.9-slim
COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin
COPY ./requirements.txt requirements.txt
RUN uname -a
RUN apt-get update -qq
RUN apt-get install build-essential git -yq
# this is temporary until opencv-python is released on pypi with arm64 support
# RUN pip install --default-timeout=1000 git+https://github.com/skvark/opencv-python.git
RUN pip install --default-timeout=1000 -r requirements.txt
WORKDIR /app
ENV FLASK_APP family_foto
ENV FLASK_RUN_HOST 0.0.0.0
COPY . .
CMD ["flask", "run"]
7 changes: 7 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: '3'
services:
web:
container_name: family-foto
image: segelzwerg/family-foto:amd64
ports:
- "5050:5000"
3 changes: 3 additions & 0 deletions uwsgi.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[uswsgi]
callable = app
master = true