Skip to content

Commit

Permalink
Merge pull request #78 from robinson/master
Browse files Browse the repository at this point in the history
multi stage build docker, to minimize the docker image
  • Loading branch information
Lissy93 authored Feb 26, 2024
2 parents ec30ef7 + af70930 commit 01fb32e
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
FROM node:16-buster-slim

RUN apt-get update && \
apt-get install -y chromium traceroute && \
chmod 755 /usr/bin/chromium && \
rm -rf /var/lib/apt/lists/*
# Build stage
FROM node:16-buster-slim AS build

WORKDIR /app

COPY package.json yarn.lock ./

RUN yarn install && \
RUN apt-get update && \
yarn install --production && \
rm -rf /app/node_modules/.cache

COPY . .

RUN yarn build
RUN yarn build --production

# Final stage
FROM node:16-buster-slim AS final

WORKDIR /app

COPY package.json yarn.lock ./
COPY --from=build /app .

RUN apt-get update && \
apt-get install -y --no-install-recommends chromium traceroute && \
chmod 755 /usr/bin/chromium && \
rm -rf /var/lib/apt/lists/* /app/node_modules/.cache

EXPOSE ${PORT:-3000}

ENV CHROME_PATH='/usr/bin/chromium'

CMD ["yarn", "serve"]
CMD ["yarn", "serve"]

0 comments on commit 01fb32e

Please sign in to comment.