Skip to content

Instantly share code, notes, and snippets.

@shojibMahabub
Last active December 10, 2018 02:44
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 shojibMahabub/acb79ae2112c7f0b71ba859dff1f8111 to your computer and use it in GitHub Desktop.
Save shojibMahabub/acb79ae2112c7f0b71ba859dff1f8111 to your computer and use it in GitHub Desktop.
Dockerfile to serve static html file
########################################
## Dockerfile [ version 3 ]
########################################
## Build
## docker build -t mahabub .
## docker run -p 8080:90 mahabub
########################################
# 1. use ubuntu 16.04 as base image
FROM ubuntu:16.04
# defining user root
USER root
# OS update
RUN apt-get update
# Installing PHP and NginX
RUN apt-get install -y wget php7.0 make gcc libpcre3 libpcre3-dev zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*
RUN cd /etc/ \
&& wget https://nginx.org/download/nginx-1.14.0.tar.gz \
&& tar zxf nginx-1.14.0.tar.gz \
&& cd nginx-1.14.0 \
&& ./configure \
&& make \
&& make install
# Remove the default Nginx configuration file
RUN rm -v /etc/nginx/nginx.conf
# Copy a configuration file from the current directory
ADD nginx.conf /etc/nginx/
ADD /opt/projects/ /usr/share/nginx/html/
# Append "daemon off;" to the beginning of the configuration
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
# Expose ports
EXPOSE 90
# Set the default command to execute
# when creating a new container
CMD service nginx start
types {
text/html html htm shtml;
text/css css;
}
worker_processes 1;
events { worker_connections 1024; }
http {
include mime.types;
sendfile on;
server {
root /usr/share/nginx/html/;
index index.html;
server_name http://127.0.0.1;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
listen 90;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment