- Newest
- Most votes
- Most comments
Anti-pattern? If your site code is less than 5mb and doesn't have bunch of static images, videos and even audios, then that'd be fine to pack in your docker image.
I should clarify it more clearly. Our code is packed in docker image, but not those static files including image, css, javascript, audio and video. We decide to move the bind mount from host volume to EFS. AWS Code Pipeline and Code Build allow us to deliver directly to EFS (NFS mount, basically) mounted on the instances. This way solves for us.
Accessing your code through a shared volume in your container is an anti-pattern. One of the benefits of containers is to package all your code, dependencies and runtime in the container. This will allow you to do blue/green deployments by having both versions of your app running in different set of containers and then switching traffic from the old version to the new one transparently for your users.
Mounting your code with a volume is fine to speed up development on your local workstation without rebuilding a full image on every code change, but for production deployment you should package everything in the container image.
Relevant content
- asked a month ago
- Accepted Answerasked 6 months ago
- AWS OFFICIALUpdated 7 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 7 months ago
FYI, maybe you are missing or anti-best practice. https://docs.docker.com/develop/dev-best-practices/ Instead, store data using volumes. https://developers.redhat.com/blog/2016/02/24/10-things-to-avoid-in-docker-containers
The original question was about "accessing website code through shared mount volume". Code is not data. This refers to anti-pattern 2 from the link. "2) Don't ship your application in two pieces". I agree that data like images and videos can be stored on a shared drive as this is content distinct from code.