Multi stage Docker build file.
This commit is contained in:
parent
10a0a8ee76
commit
ae926d74fc
20
Dockerfile
20
Dockerfile
@ -1,13 +1,23 @@
|
|||||||
FROM python:3-alpine
|
FROM python:3-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
COPY requirements.txt ./
|
COPY requirements.txt ./
|
||||||
|
|
||||||
RUN apk --no-cache add gcc musl-dev libffi-dev openssl-dev libxml2-dev libxslt-dev file llvm-dev make g++ \
|
# Build Dependencies
|
||||||
&& pip install --no-cache-dir wheel cryptography gunicorn pymysql \
|
RUN apk --no-cache --virtual build-deps add gcc musl-dev libffi-dev openssl-dev libxml2-dev libxslt-dev file llvm-dev make g++
|
||||||
&& pip install --no-cache-dir -r requirements.txt \
|
|
||||||
&& apk del gcc musl-dev libffi-dev openssl-dev file llvm-dev make g++
|
# Python Dependencies
|
||||||
|
RUN pip install --no-cache-dir --prefix=/install wheel cryptography gunicorn pymysql
|
||||||
|
RUN pip install --no-cache-dir --prefix=/install -r requirements.txt
|
||||||
|
|
||||||
|
FROM python:3-alpine
|
||||||
|
|
||||||
|
WORKDIR /usr/src/app
|
||||||
|
|
||||||
|
# Runtime Dependencies
|
||||||
|
RUN apk --no-cache add libxml2 libxslt
|
||||||
|
COPY --from=builder /install /usr/local
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user