Merge pull request #1 from LordChunk/reduce-docker-image-size

Improved Docker image size
This commit is contained in:
Job 2021-10-13 01:48:31 +02:00 committed by GitHub
commit 4451e6af33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 6 deletions

View File

@ -5,19 +5,20 @@ COPY ./static/package*.json /code/static/
RUN cd /code/static && npm install
# Main image
FROM python:3.7
FROM python:3.7-alpine
# install poetry, "pip3 install poetry==1.1.5" doesn't work
# poetry will be available at /root/.poetry/bin/poetry
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
# install poetry
RUN apk update \
&& apk add --no-cache build-base openssl-dev libffi-dev \
&& pip3 install poetry
WORKDIR /code
# install dependencies
COPY poetry.lock pyproject.toml ./
RUN /root/.poetry/bin/poetry config virtualenvs.create false \
&& /root/.poetry/bin/poetry install --no-root
RUN poetry config virtualenvs.create false \
&& poetry install --no-root
# copy npm packages
COPY --from=npm /code /code