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,6 @@
# DON'T UPDATE TO node:14-bullseye-slim, see #372.
# If the image changed, the second stage image should be changed too
FROM node:18-buster-slim
FROM node:18-buster-slim AS base2-slim
ARG TARGETPLATFORM
# Install Curl
@@ -24,3 +24,13 @@ RUN node ./extra/download-cloudflared.js $TARGETPLATFORM && \
rm -f cloudflared.deb && \
apt --yes autoremove
FROM base2-slim AS base2
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 --yes remove curl && \
rm -rf /var/lib/apt/lists/* && \
apt --yes autoremove
RUN chown -R node:node /var/lib/mysql

View File

@@ -0,0 +1,13 @@
version: '3.8'
services:
uptime-kuma:
container_name: uptime-kuma-dev
image: louislam/uptime-kuma:nightly2
volumes:
- ./data:/app/data
- ../server:/app/server
ports:
- "3001:3001" # <Host Port>:<Container Port>
- "3307:3306"

View File

@@ -1,14 +1,15 @@
# Simple docker-compose.yml
# You can change your port or volume location
version: '3.3'
version: '3.8'
services:
uptime-kuma:
image: louislam/uptime-kuma:1
image: louislam/uptime-kuma:2
container_name: uptime-kuma
volumes:
- ./uptime-kuma-data:/app/data
- uptime-kuma:/app/data
ports:
- 3001:3001 # <Host Port>:<Container Port>
- "3001:3001" # <Host Port>:<Container Port>
restart: always
volumes:
uptime-kuma:

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"]

View File