Skip to content

Instantly share code, notes, and snippets.

@jahrlin
Created April 26, 2016 18:56
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 jahrlin/884feb539aba1c6e576aa9b5793f5239 to your computer and use it in GitHub Desktop.
Save jahrlin/884feb539aba1c6e576aa9b5793f5239 to your computer and use it in GitHub Desktop.
# use the nginx image from docker
FROM nginx
MAINTAINER Joakim Ahrlin "joakim.ahrlin@gmail.com"
# update stuffs, install some more stuff
RUN apt-get update && apt-get install -y \
git \
curl \
mercurial
# install Go on the container, this is only required if you are using Hugo to
# generate your static content like I am
RUN mkdir /goroot && curl
https://storage.googleapis.com/golang/go1.6.linux-amd64.tar.gz | tar xvzf - -C
/goroot --strip-components=1
RUN mkdir /gopath
ENV GOROOT /goroot
ENV GOPATH /gopath
ENV PATH $PATH:$GOROOT/bin:$GOPATH/bin
# install Hugo, the static site generator
# if you want to use something else, like Webpack or jekyll, just install them instead
RUN go get -v github.com/spf13/hugo
RUN go install github.com/spf13/hugo
# copy source files (from the repo) to the container
ADD site-source /site-source
# run the 'hugo' command, generates the static content for the website
RUN cd /site-source && \
hugo
# now copy the generated files to our web root
RUN cp -R /site-source/public /app/
# add our nginx configuration (from the git repo) to the container
ADD nginx.conf /etc/nginx/nginx.conf
# make sure we expose port 80, required by our nginx proxy
EXPOSE 80
# run the nginx server
# as long as this command is running the container will stay up
CMD ["/usr/sbin/nginx"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment