This commit is contained in:
Louis Lam
2023-02-05 17:45:36 +08:00
parent 33d9c1bbb1
commit dc4d2a77bb
9 changed files with 171 additions and 69 deletions

View File

@@ -1,6 +1,8 @@
ARG BASE_IMAGE=louislam/uptime-kuma:base2
############################################
# Build in Golang
# Run npm run build-healthcheck-armv7 in the host first, another it will be super slow where it is building the armv7 healthcheck
# Run npm run build-healthcheck-armv7 in the host first, otherwise it will be super slow where it is building the armv7 healthcheck
# Check file: builder-go.dockerfile
############################################
FROM louislam/uptime-kuma:builder-go AS build_healthcheck
@@ -9,6 +11,7 @@ FROM louislam/uptime-kuma:builder-go AS build_healthcheck
# Build in Node.js
############################################
FROM louislam/uptime-kuma:base2 AS build
USER node
WORKDIR /app
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
@@ -20,34 +23,20 @@ COPY . .
COPY --chown=node:node --from=build_healthcheck /app/extra/healthcheck /app/extra/healthcheck
############################################
# ⭐ Main Image (Slim)
# ⭐ Main Image
############################################
FROM louislam/uptime-kuma:base2 AS release-slim
FROM $BASE_IMAGE AS release
USER node
WORKDIR /app
# Copy app files from build layer
COPY --chown=node:node --from=build /app /app
EXPOSE 3001
VOLUME ["/app/data"]
HEALTHCHECK --interval=60s --timeout=30s --start-period=180s --retries=5 CMD extra/healthcheck
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["node", "server/server.js"]
############################################
# ⭐ Main Image (With MariaDB)
############################################
FROM release-slim AS release
RUN apt update && \
apt --yes --no-install-recommends install curl && \
curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | bash -s -- --mariadb-server-version="mariadb-10.11" && \
apt --yes --no-install-recommends install mariadb-server && \
apt remove curl && \
rm -rf /var/lib/apt/lists/* && \
apt --yes autoremove
############################################
# Mark as Nightly
############################################
@@ -58,10 +47,8 @@ RUN npm run mark-as-nightly
############################################
# Build an image for testing pr
############################################
FROM louislam/uptime-kuma:base2 AS pr-test
FROM louislam/uptime-kuma:base2 AS pr-test2
WORKDIR /app
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
## Install Git
@@ -83,7 +70,6 @@ RUN git clone https://github.com/louislam/uptime-kuma.git .
RUN npm ci
EXPOSE 3000 3001
VOLUME ["/app/data"]
HEALTHCHECK --interval=60s --timeout=30s --start-period=180s --retries=5 CMD node extra/healthcheck.js
CMD ["npm", "run", "start-pr-test"]