mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-10 04:22:27 +10:00
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.
This commit is contained in:
30
Dockerfile
30
Dockerfile
@ -1,12 +1,32 @@
|
||||
FROM node as builder
|
||||
|
||||
FROM node:alpine as builder
|
||||
WORKDIR /app
|
||||
COPY ./ /app/
|
||||
|
||||
RUN npm install
|
||||
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
|
||||
COPY server.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
Reference in New Issue
Block a user