Skip to content

Instantly share code, notes, and snippets.

@gilday
Created September 23, 2016 01:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gilday/806871c7e55e68caf700c348c45f69b0 to your computer and use it in GitHub Desktop.
Save gilday/806871c7e55e68caf700c348c45f69b0 to your computer and use it in GitHub Desktop.
data only container for static web content
FROM nginx
ADD ./index.html /usr/share/nginx/html/index.html
VOLUME /usr/share/nginx/html
<!doctype html>
<html>
<body>
<h1>Hello, World</h1>
</body>
</html>
version: '2'
services:
# frontend nginx steals web content volume from service "content"
frontend:
image: nginx
ports:
- 80
volumes_from:
- content:ro
# build docker image with static content in /usr/share/nginx/html
# use nginx image to share layers
# reassign entrypoint to /bin/true so the container exits immediately - only need its volume
content:
build: ./content
entrypoint: /bin/true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment