Add a pypy docker image. (#129)
This commit is contained in:
parent
027f35983b
commit
d654ed132d
39
.github/workflows/docker-build.yml
vendored
39
.github/workflows/docker-build.yml
vendored
@ -8,7 +8,7 @@ on:
|
|||||||
- dev-indep
|
- dev-indep
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-docker:
|
cpython-build-docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@ -45,3 +45,40 @@ jobs:
|
|||||||
tags: ytorg/yotter:latest
|
tags: ytorg/yotter:latest
|
||||||
cache-from: type=local,src=cache
|
cache-from: type=local,src=cache
|
||||||
cache-to: type=local,dest=cache
|
cache-to: type=local,dest=cache
|
||||||
|
pypy-build-docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
with:
|
||||||
|
platforms: all
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
- name: Get hash of latest image
|
||||||
|
run: docker pull pypy:3-slim-buster && docker inspect --format='{{index .RepoDigests 0}}' pypy:3-slim-buster > dockerhash.txt
|
||||||
|
- name: cache docker cache
|
||||||
|
uses: actions/cache@v2.1.2
|
||||||
|
with:
|
||||||
|
path: ${{ github.workspace }}/cache
|
||||||
|
key: ${{ runner.os }}-docker-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/dockerhash.txt') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-docker-
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./pypy.Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ytorg/yotter:pypy
|
||||||
|
cache-from: type=local,src=cache
|
||||||
|
cache-to: type=local,dest=cache
|
||||||
|
40
pypy.Dockerfile
Normal file
40
pypy.Dockerfile
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
FROM pypy:3-slim-buster AS base
|
||||||
|
|
||||||
|
# Image to Build Dependencies
|
||||||
|
FROM base AS builder
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
COPY ./requirements.txt /usr/src/app
|
||||||
|
|
||||||
|
# Build Dependencies
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -yq build-essential libssl-dev libffi-dev libxml2-dev libxslt-dev zlib1g-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/*
|
||||||
|
|
||||||
|
# Python Dependencies
|
||||||
|
RUN pip install --no-warn-script-location --ignore-installed --no-cache-dir --prefix=/install wheel cryptography gunicorn pymysql
|
||||||
|
RUN pip install --no-warn-script-location --ignore-installed --no-cache-dir --prefix=/install -r requirements.txt
|
||||||
|
|
||||||
|
# Runtime Environment Image
|
||||||
|
FROM base
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
COPY --from=builder /install/bin /usr/local/bin
|
||||||
|
COPY --from=builder /install/site-packages /opt/pypy/site-packages
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
libxml2 libxslt1.1 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/*
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN flask db init
|
||||||
|
|
||||||
|
CMD flask db stamp head \
|
||||||
|
&& flask db migrate \
|
||||||
|
&& flask db upgrade \
|
||||||
|
&& gunicorn -b 0.0.0.0:5000 -k gevent -w 4 yotter:app
|
||||||
|
|
||||||
|
EXPOSE 5000
|
Reference in New Issue
Block a user