mirror of
https://github.com/Lissy93/web-check.git
synced 2025-05-01 21:04:28 +02:00
Merge pull request #78 from robinson/master
multi stage build docker, to minimize the docker image
This commit is contained in:
commit
01fb32e43c
26
Dockerfile
26
Dockerfile
@ -1,20 +1,30 @@
|
|||||||
FROM node:16-buster-slim
|
# Build stage
|
||||||
|
FROM node:16-buster-slim AS build
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y chromium traceroute && \
|
|
||||||
chmod 755 /usr/bin/chromium && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY package.json yarn.lock ./
|
COPY package.json yarn.lock ./
|
||||||
|
|
||||||
RUN yarn install && \
|
RUN apt-get update && \
|
||||||
|
yarn install --production && \
|
||||||
rm -rf /app/node_modules/.cache
|
rm -rf /app/node_modules/.cache
|
||||||
|
|
||||||
COPY . .
|
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}
|
EXPOSE ${PORT:-3000}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user