Docker, web app static files. Best practices?

How do people tend to handle static assets in web deployment on docker?

For example, in a django app deployed in a container, do you have the app server serve up the static files from the container, or do you sync them to another server for a webserver to serve, or do you use a CDN?

  • How to use/link remote postgres db with django docker implementation
  • Docker volume data does not get saved to host folder in mac
  • Running Travis locally using docker
  • Clashing between two postgres database though having two different docker-compose yaml files for django projects
  • Getting 502 Bad Gateway while running the Django application within a docker container?
  • Windows Containers : Unable to ping containers created with transparent network from other hosts
  • If not serving from the app container, when do you push files to CDN or webserver: as part of the container build, or as a second process in the build, and how do you ensure both steps stay in sync?

  • Does 'docker run' modify image state?
  • Merge two docker images
  • Managing and Utilizing Multiple Docker Containers (Microservices) in a Single Server
  • Error running erlang in Windows Container
  • Cron job break other foreground server in docker
  • Breakpoints skipped when remote debugging with eclipse PDT and Docker container (docker for mac)
  • One Solution collect form web for “Docker, web app static files. Best practices?”

    You will have to use a form of cloud storage to achieve that. S3 for example. You can also host your static files just like a CDN. Since you’re using django, consider reading this article. It explains how to host static files from within a django app.

    As a Laravel user you could use Laravels built in flysystem support.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.