27 lines
697 B
Docker
27 lines
697 B
Docker
FROM python:alpine
|
|
|
|
ADD requirements.txt /app/requirements.txt
|
|
|
|
RUN apk update && apk upgrade && \
|
|
apk add --no-cache bash && \
|
|
rm -rf /var/cache/apk/* && \
|
|
set -ex && \
|
|
python -m venv /env && \
|
|
/env/bin/pip install --upgrade pip && \
|
|
/env/bin/pip install --no-cache-dir -r /app/requirements.txt && \
|
|
runDeps="$(scanelf --needed --nobanner --recursive /env \
|
|
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
|
|
| sort -u \
|
|
| xargs -r apk info --installed \
|
|
| sort -u)" && \
|
|
apk add --virtual rundeps $runDeps && \
|
|
apk del rundeps
|
|
|
|
ADD . /app
|
|
WORKDIR /app
|
|
|
|
ENV VIRTUAL_ENV=/env
|
|
ENV PATH=/env/bin:$PATH
|
|
|
|
CMD ["python", "main.py"]
|