pidgin/nest

a2f826124bf3
Parents 1e66a7c53e49
Children f1faf9a5483a
Multistage Dockerfile and Formatting

Riffing off work from Grim's work
  • +28 -21
    Dockerfile
  • --- a/Dockerfile Sat May 04 05:08:02 2019 -0500
    +++ b/Dockerfile Tue May 28 03:03:30 2019 +0100
    @@ -1,26 +1,33 @@
    -FROM debian:buster as build
    +#####################################################################
    +# run the hugo build
    +#####################################################################
    -RUN set -ex && \
    - apt-get update && \
    - apt-get install -y hugo npm && \
    - npm i -g npm@6.4.1 && \
    - apt-get clean && \
    - rm -rf /var/lib/apt/lists
    +FROM debian:buster as hugo-build
    +RUN set -ex && \
    + apt-get update && \
    + apt-get install -y hugo && \
    + apt-get clean && \
    + rm -rf /var/lib/apt/lists
    +COPY hugo /nest/hugo
    +RUN hugo -s /nest/hugo -d /nest/public
    -COPY package-lock.json package.json /nest/
    +#####################################################################
    +# setup up our node environment
    +#####################################################################
    -RUN set -ex && \
    - cd /nest && \
    - npm ci --production && \
    - npm cache clean --force
    -
    -COPY . /nest
    +FROM node:10-stretch-slim as node-build
    +WORKDIR /nest/
    +COPY package-lock.json package.json ./
    +RUN npm ci --production && \
    + npm cache clean --force
    +COPY tools ./tools
    +COPY --from=hugo-build /nest/public public
    +RUN node tools/pre-prod.js
    -RUN hugo -s /nest/hugo -d /nest/public && \
    - node /nest/tools/pre-prod.js
    +#####################################################################
    +# finally package everything up with rwgrim/goserve
    +#####################################################################
    -FROM rwgrim/goserve
    -
    -COPY --from=build /nest/public /html
    -
    -EXPOSE 3000/tcp
    +FROM rwgrim/goserve
    +COPY --from=node-build /nest/public /html/
    +EXPOSE 3000/tcp