This repository has been archived on 2022-06-28. You can view files and clone it, but cannot push or open issues or pull requests.
Yotter/pypy.Dockerfile

47 lines
1.2 KiB
Docker
Raw Permalink Normal View History

2020-10-31 00:15:55 +05:30
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 curl \
2020-10-31 00:15:55 +05:30
&& rm -rf /var/lib/apt/lists/* /etc/apt/sources.list.d/*
# install rust toolchain
RUN curl https://sh.rustup.rs -sSf | \
sh -s -- --default-toolchain stable -y
ENV PATH=/root/.cargo/bin:$PATH
2020-10-31 00:15:55 +05:30
# 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