mirror of
https://github.com/simple-login/app.git
synced 2025-02-24 07:43:54 +08:00
Improved Docker image size
Improved Docker image size by using python's alpine image and installing the required dependencies seperately. This reduces the size of the image from 1.46 GB to 0.982 GB
This commit is contained in:
parent
572f25ff75
commit
961daa91f3
1 changed files with 7 additions and 6 deletions
13
Dockerfile
13
Dockerfile
|
@ -5,19 +5,20 @@ COPY ./static/package*.json /code/static/
|
||||||
RUN cd /code/static && npm install
|
RUN cd /code/static && npm install
|
||||||
|
|
||||||
# Main image
|
# Main image
|
||||||
FROM python:3.7
|
FROM python:3.7-alpine
|
||||||
|
|
||||||
# install poetry, "pip3 install poetry==1.1.5" doesn't work
|
# install poetry
|
||||||
# poetry will be available at /root/.poetry/bin/poetry
|
RUN apk update \
|
||||||
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
|
&& apk add --no-cache build-base openssl-dev libffi-dev \
|
||||||
|
&& pip3 install poetry
|
||||||
|
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
|
|
||||||
# install dependencies
|
# install dependencies
|
||||||
COPY poetry.lock pyproject.toml ./
|
COPY poetry.lock pyproject.toml ./
|
||||||
|
|
||||||
RUN /root/.poetry/bin/poetry config virtualenvs.create false \
|
RUN poetry config virtualenvs.create false \
|
||||||
&& /root/.poetry/bin/poetry install --no-root
|
&& poetry install --no-root
|
||||||
|
|
||||||
# copy npm packages
|
# copy npm packages
|
||||||
COPY --from=npm /code /code
|
COPY --from=npm /code /code
|
||||||
|
|
Loading…
Reference in a new issue