mirror of
https://github.com/simple-login/app.git
synced 2024-11-16 00:48:32 +01:00
Merge pull request #654 from LordChunk/master
Improved Docker image size
This commit is contained in:
commit
9f36f3e2a9
1 changed files with 22 additions and 7 deletions
29
Dockerfile
29
Dockerfile
|
@ -5,19 +5,34 @@ COPY ./static/package*.json /code/static/
|
|||
RUN cd /code/static && npm install
|
||||
|
||||
# Main image
|
||||
FROM python:3.7
|
||||
FROM python:3.7-slim
|
||||
|
||||
# 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 -
|
||||
# Keeps Python from generating .pyc files in the container
|
||||
ENV PYTHONDONTWRITEBYTECODE 1
|
||||
# Turns off buffering for easier container logging
|
||||
ENV PYTHONUNBUFFERED 1
|
||||
|
||||
# Add poetry to PATH
|
||||
ENV PATH="${PATH}:/root/.poetry/bin"
|
||||
|
||||
WORKDIR /code
|
||||
|
||||
# install dependencies
|
||||
# Copy poetry files
|
||||
COPY poetry.lock pyproject.toml ./
|
||||
|
||||
RUN /root/.poetry/bin/poetry config virtualenvs.create false \
|
||||
&& /root/.poetry/bin/poetry install --no-root
|
||||
# Install and setup poetry
|
||||
RUN pip install -U pip \
|
||||
&& apt-get update \
|
||||
&& apt install -y curl netcat gcc python3-dev \
|
||||
&& curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - \
|
||||
# Remove curl and netcat from the image
|
||||
&& apt-get purge -y curl netcat \
|
||||
# Run poetry
|
||||
&& poetry config virtualenvs.create false \
|
||||
&& poetry install --no-interaction --no-ansi --no-root \
|
||||
# Clear apt cache
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# copy npm packages
|
||||
COPY --from=npm /code /code
|
||||
|
|
Loading…
Reference in a new issue