mirror of
https://github.com/simple-login/app.git
synced 2024-09-30 05:31:30 +02:00
Merge pull request #654 from LordChunk/master
Improved Docker image size
This commit is contained in:
commit
9f36f3e2a9
29
Dockerfile
29
Dockerfile
@ -5,19 +5,34 @@ 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-slim
|
||||||
|
|
||||||
# install poetry, "pip3 install poetry==1.1.5" doesn't work
|
# Keeps Python from generating .pyc files in the container
|
||||||
# poetry will be available at /root/.poetry/bin/poetry
|
ENV PYTHONDONTWRITEBYTECODE 1
|
||||||
RUN curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
|
# Turns off buffering for easier container logging
|
||||||
|
ENV PYTHONUNBUFFERED 1
|
||||||
|
|
||||||
|
# Add poetry to PATH
|
||||||
|
ENV PATH="${PATH}:/root/.poetry/bin"
|
||||||
|
|
||||||
WORKDIR /code
|
WORKDIR /code
|
||||||
|
|
||||||
# install dependencies
|
# Copy poetry files
|
||||||
COPY poetry.lock pyproject.toml ./
|
COPY poetry.lock pyproject.toml ./
|
||||||
|
|
||||||
RUN /root/.poetry/bin/poetry config virtualenvs.create false \
|
# Install and setup poetry
|
||||||
&& /root/.poetry/bin/poetry install --no-root
|
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 npm packages
|
||||||
COPY --from=npm /code /code
|
COPY --from=npm /code /code
|
||||||
|
Loading…
Reference in New Issue
Block a user