Improve dockerfile

pull/2578/head
Louis Lam 2 years ago
parent 24d1dd4c34
commit 71f4ab0aa6

@ -8,9 +8,9 @@ ARG TARGETPLATFORM
COPY ./extra/ ./extra/ COPY ./extra/ ./extra/
# Compile healthcheck.go # Compile healthcheck.go
RUN apt update RUN apt update && \
RUN apt --yes --no-install-recommends install curl apt --yes --no-install-recommends install curl && \
RUN curl -sL https://deb.nodesource.com/setup_18.x | bash curl -sL https://deb.nodesource.com/setup_18.x | bash && \
RUN apt --yes --no-install-recommends install nodejs apt --yes --no-install-recommends install nodejs && \
RUN node -v node ./extra/build-healthcheck.js $TARGETPLATFORM && \
RUN node ./extra/build-healthcheck.js $TARGETPLATFORM apt --yes remove nodejs

@ -12,10 +12,13 @@ FROM louislam/uptime-kuma:base-debian AS build
WORKDIR /app WORKDIR /app
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
COPY .npmrc .npmrc
COPY package.json package.json
COPY package-lock.json package-lock.json
RUN npm ci --omit=dev
COPY . . COPY . .
COPY --from=build_healthcheck /app/extra/healthcheck /app/extra/healthcheck COPY --from=build_healthcheck /app/extra/healthcheck /app/extra/healthcheck
RUN npm ci --production && \ RUN chmod +x /app/extra/entrypoint.sh
chmod +x /app/extra/entrypoint.sh
############################################ ############################################
# ⭐ Main Image # ⭐ Main Image

@ -3,10 +3,12 @@ WORKDIR /app
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1 ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
COPY .npmrc .npmrc
COPY package.json package.json
COPY package-lock.json package-lock.json
RUN npm ci --omit=dev
COPY . . COPY . .
RUN npm ci --production && \ RUN chmod +x /app/extra/entrypoint.sh
chmod +x /app/extra/entrypoint.sh
FROM louislam/uptime-kuma:base-alpine AS release FROM louislam/uptime-kuma:base-alpine AS release
WORKDIR /app WORKDIR /app

Loading…
Cancel
Save