Files
Reactive-Resume/Dockerfile
Matt Low d6ae8309b4 Dockerfile improvements
- Add missing build dependencies for `sharp` node module (dependency of
  `gatsby-plugin-sharp`).
- Add ARG instructions for firebase variables, allowing them to be set
  via --build-arg flags when building the image.
- Use `npm ci` instead of `npm install`, and execute it after copying
  only package*.json. This prevents having to fetch all dependencies if
  package*.json hasn't changed between builds.
- Use `node:alpine` instead of `node` - not an improvement per-se,
  but I happen to be more familiar with adding build dependecies in the
  alpine based node image.
2021-02-14 00:41:29 -07:00

33 lines
619 B
Docker

FROM node:alpine as builder
WORKDIR /app
RUN apk update \
&& apk add --no-cache \
g++ \
yasm \
make \
automake \
autoconf \
libtool \
vips-dev
COPY package*.json ./
RUN npm ci
ARG FIREBASE_APIKEY
ARG FIREBASE_APPID
ARG FIREBASE_AUTHDOMAIN
ARG FIREBASE_DATABASEURL
ARG FIREBASE_MEASUREMENTID
ARG FIREBASE_MESSAGINGSENDERID
ARG FIREBASE_PROJECTID
ARG FIREBASE_STORAGEBUCKET
COPY . ./
RUN npm run build
FROM nginx:alpine
RUN rm -rf /usr/share/nginx/html
COPY --from=builder /app/public/ /usr/share/nginx/html
COPY server.conf /etc/nginx/conf.d/default.conf