简体   繁体   中英

Serving static files from Python alpine image: no /etc/mine.types file found

I have an Python Django application that I want to deploy through docker-compose, I used the blogpost called A Production-ready Dockerfile for Your Python/Django App to setup my files.

This blogpost, however, assumes you use a third party to host your static files. Since this isn't the case, I changed the CMD command from:

CMD ["/venv/bin/uwsgi", "--http-auto-chunked", "--http-keepalive"]

to:

CMD ["/venv/bin/uwsgi", "--http-auto-chunked", "--http-keepalive", "--static-map", "/static=/code/base/static"]

This works more or less, I now however receive the following warning when I start my docker file: backend_1 | !!! no /etc/mime.types file found !!! backend_1 | !!! no /etc/mime.types file found !!!

This makes my solution not workable, since files are all interpreted as text/plain . Is there a simple solution to fix this?

You need a mailcap package in your alpine container. Add the below to Dockerfile

RUN apk add mailcap

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM