diff --git a/.dockerignore b/.dockerignore index 3d92084d..539e9328 100644 --- a/.dockerignore +++ b/.dockerignore @@ -19,7 +19,6 @@ README.md .eslint* .stylelint* /.github -package-lock.json yarn.lock app.json CODE_OF_CONDUCT.md diff --git a/docker/alpine-base.dockerfile b/docker/alpine-base.dockerfile new file mode 100644 index 00000000..922fd252 --- /dev/null +++ b/docker/alpine-base.dockerfile @@ -0,0 +1,8 @@ +# DON'T UPDATE TO alpine3.13, 1.14, see #41. +FROM node:14-alpine3.12 +WORKDIR /app + +# Install apprise, iputils for non-root ping, setpriv +RUN apk add --no-cache iputils setpriv dumb-init python3 py3-cryptography py3-pip py3-six py3-yaml py3-click py3-markdown py3-requests py3-requests-oauthlib && \ + pip3 --no-cache-dir install apprise && \ + rm -rf /root/.cache diff --git a/docker/debian-base.dockerfile b/docker/debian-base.dockerfile new file mode 100644 index 00000000..e8737c7c --- /dev/null +++ b/docker/debian-base.dockerfile @@ -0,0 +1,11 @@ +# DON'T UPDATE TO node:14-bullseye-slim, see #372. +# If the image changed, the second stage image should be changed too +FROM node:14-buster-slim +WORKDIR /app + +# Install Apprise, add sqlite3 cli for debugging in the future, iputils-ping for ping, util-linux for setpriv +RUN apt update && \ + apt --yes install python3 python3-pip python3-cryptography python3-six python3-yaml python3-click python3-markdown python3-requests python3-requests-oauthlib \ + sqlite3 iputils-ping util-linux dumb-init && \ + pip3 --no-cache-dir install apprise && \ + rm -rf /var/lib/apt/lists/* diff --git a/dockerfile b/dockerfile index e0616ba2..cabe8a07 100644 --- a/dockerfile +++ b/dockerfile @@ -1,6 +1,4 @@ -# DON'T UPDATE TO node:14-bullseye-slim, see #372. -# If the image changed, the second stage image should be changed too -FROM node:14-buster-slim AS build +FROM louislam/uptime-kuma:base-debian AS build WORKDIR /app COPY . . @@ -10,16 +8,9 @@ RUN npm install --legacy-peer-deps && \ chmod +x /app/extra/entrypoint.sh -FROM node:14-buster-slim AS release +FROM louislam/uptime-kuma:base-debian AS release WORKDIR /app -# Install Apprise, add sqlite3 cli for debugging in the future, iputils-ping for ping, util-linux for setpriv -RUN apt update && \ - apt --yes install python3 python3-pip python3-cryptography python3-six python3-yaml python3-click python3-markdown python3-requests python3-requests-oauthlib \ - sqlite3 iputils-ping util-linux dumb-init && \ - pip3 --no-cache-dir install apprise && \ - rm -rf /var/lib/apt/lists/* - # Copy app files from build layer COPY --from=build /app /app diff --git a/dockerfile-alpine b/dockerfile-alpine index 07ae3079..178afcab 100644 --- a/dockerfile-alpine +++ b/dockerfile-alpine @@ -1,5 +1,4 @@ -# DON'T UPDATE TO alpine3.13, 1.14, see #41. -FROM node:14-alpine3.12 AS build +FROM louislam/uptime-kuma:base-alpine AS build WORKDIR /app COPY . . @@ -9,14 +8,9 @@ RUN npm install --legacy-peer-deps && \ chmod +x /app/extra/entrypoint.sh -FROM node:14-alpine3.12 AS release +FROM louislam/uptime-kuma:base-alpine AS release WORKDIR /app -# Install apprise, iputils for non-root ping, setpriv -RUN apk add --no-cache iputils setpriv dumb-init python3 py3-cryptography py3-pip py3-six py3-yaml py3-click py3-markdown py3-requests py3-requests-oauthlib && \ - pip3 --no-cache-dir install apprise && \ - rm -rf /root/.cache - # Copy app files from build layer COPY --from=build /app /app diff --git a/package.json b/package.json index 7828b9dc..17bfe975 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,8 @@ "tsc": "tsc", "vite-preview-dist": "vite preview --host", "build-docker": "npm run build-docker-debian && npm run build-docker-alpine", + "build-docker-alpine-base": "docker buildx build -f docker/alpine-base.dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:base-alpine . --push", + "build-docker-debian-base": "docker buildx build -f docker/debian-base.dockerfile --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:base-debian . --push", "build-docker-alpine": "docker buildx build -f dockerfile-alpine --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:alpine -t louislam/uptime-kuma:1-alpine -t louislam/uptime-kuma:1.7.3-alpine --target release . --push", "build-docker-debian": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma -t louislam/uptime-kuma:1 -t louislam/uptime-kuma:1.7.3 -t louislam/uptime-kuma:debian -t louislam/uptime-kuma:1-debian -t louislam/uptime-kuma:1.7.3-debian --target release . --push", "build-docker-nightly": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:nightly --target nightly . --push",