Skip to content

Instantly share code, notes, and snippets.

@beardedtim
Created May 11, 2018 17:07
Show Gist options
  • Select an option

  • Save beardedtim/4f6e2a31636927e60abde9eca3f6a58f to your computer and use it in GitHub Desktop.

Select an option

Save beardedtim/4f6e2a31636927e60abde9eca3f6a58f to your computer and use it in GitHub Desktop.
Basic Dockerfile/docker-compose for Nginx

This assumes the following structure:

|- Root
  | docker-compose.yml
  | nginx -
      | Dockerfile
      | nginx.conf
      | data -
          | www
          | images
version: '3'
services:
nginx:
build:
context: ./nginx
dockerfile: Dockerfile
ports:
- "9988:80"
volumes:
- "./nginx/data:/data"
# Set base image
FROM nginx
# Who run it?
LABEL MAINTAINER="Tim Roberts"
# Move nginx.conf to container
COPY ./nginx.conf /etc/nginx/nginx.conf
events {
worker_connections 4096; ## Default: 1024
}
http {
server {
location / {
root /data/www;
}
location /images/ {
root /data;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment