diff --git a/esim-cloud-backend/Dockerfile b/esim-cloud-backend/Dockerfile index f4ec46ad..48912e93 100644 --- a/esim-cloud-backend/Dockerfile +++ b/esim-cloud-backend/Dockerfile @@ -1,4 +1,5 @@ -FROM python:3.7-alpine3.13 +# Builder stage 1: NGSpice and Compiling tools +FROM python:3.7-alpine3.13 as builder ENV PYTHONUNBUFFERED 1 ENV PYTHONDONTWRITEBYTECODE 1 @@ -31,7 +32,11 @@ RUN curl -fSL https://github.com/imr/ngspice/archive/ngspice-$NGSPICE_VERSION.ta && make install \ && apk del .build-deps -# Arduino Cli and Compiling tools +# Builder stage 2: Arduino CLI and Compiling tools +FROM python:3.7-alpine3.13 as arduino_builder + +ENV USER=root + RUN apk add \ wget \ tar \ @@ -61,8 +66,19 @@ RUN arduino-cli core update-index \ && find . -name ctags -exec ln -nsf /usr/bin/ctags {} \; +# Final stage +FROM python:3.7-alpine3.13 + +ENV PYTHONUNBUFFERED 1 +ENV PYTHONDONTWRITEBYTECODE 1 + RUN apk add --no-cache libxt jpeg-dev zlib-dev libxaw-dev libx11-dev libtool mariadb-connector-c-dev libffi-dev postgresql-dev +COPY --from=builder /usr/local /usr/local +COPY --from=arduino_builder /usr/bin/arduino-cli /usr/bin/arduino-cli + +WORKDIR /code + COPY requirements.txt /code/ RUN apk add --no-cache mariadb-connector-c-dev ;\ apk add --update alpine-sdk && \