Skip to content

Using slim docker base image to reduce image size #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lospejos opened this issue Jul 30, 2020 · 1 comment
Open

Using slim docker base image to reduce image size #4

lospejos opened this issue Jul 30, 2020 · 1 comment

Comments

@lospejos
Copy link

I will suggest to consider using the slim/alpine docker base image (f.e. see here: https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker) to reduce the final image size, if it is possible.

@naveenmarthala
Copy link

naveenmarthala commented Oct 18, 2020

This is my docker file. Works perfectly and as expected. I am using python3.8-slim as my base image.

FROM tiangolo/uvicorn-gunicorn:python3.8-slim
LABEL maintainer="Sebastian Ramirez <[email protected]>"


COPY ./api /app/api
COPY requirements.txt /api/requirements.txt
RUN pip install --no-cache-dir -r /api/requirements.txt

ENV PYTHONPATH=/app
WORKDIR /app/api

EXPOSE 3000

ENTRYPOINT ["uvicorn"]

CMD ["api.main:app", "--host", "0.0.0.0", "--port", "3000"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants