Skip to content

Commit

Permalink
build(docker): reorder instructions for build caching
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Nov 16, 2022
1 parent 7951d7d commit 8e00afd
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,30 @@ FROM node:lts-bullseye-slim
# Workdir
WORKDIR /usr/app

# Copy and install packages
COPY . .
# Create temp folder for files to be stored whilst being converted
RUN mkdir -p ./src/temp/ && \
## Allow for temp folder to be manipulated
chown -R node ./src/

# Install OS dependencies
# Curl needed for healthcheck command
RUN apt-get -q update && \
RUN apt-get -q update &&\
apt-get -y --no-install-recommends install curl poppler-data poppler-utils unrtf && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
npm ci --ignore-scripts --omit=dev && \
rm -rf /var/lib/apt/lists/*

# Copy and install node dependencies
COPY package.json package-lock.json ./
RUN npm ci --ignore-scripts --omit=dev && \
npm cache clean --force && \
chown node ./node_modules/htmltidy2/bin/linux64/tidy && \
chmod 100 ./node_modules/htmltidy2/bin/linux64/tidy && \
# Remove included Windows binaries
rm -rf ./node_modules/node-poppler/src/lib/* && \
rm -rf ./node_modules/node-unrtf/src/lib/*

# Create temp folder for files to be stored whilst being converted
RUN mkdir ./src/temp/ && \
## Allow for temp folder to be manipulated
chown -R node ./src/
# Copy source
COPY . .

# Node images provide 'node' unprivileged user to run apps and prevent
# privilege escalation attacks
Expand Down

0 comments on commit 8e00afd

Please sign in to comment.