cache the sqlite built when docker build

This commit is contained in:
LouisLam 2021-07-14 12:42:52 +08:00
parent 137f5da3da
commit 3b52433202
2 changed files with 6 additions and 5 deletions

View file

@ -1,11 +1,12 @@
FROM node:14-alpine3.14 FROM node:14-alpine3.14
WORKDIR /app
# sqlite have to build on arm RUN apk add --no-cache make g++ python3 py3-pip python3-dev
# TODO: use prebuilt sqlite for arm, because it is very very slow.
RUN apk add --no-cache make g++ python3
RUN ln -s /usr/bin/python3 /usr/bin/python RUN ln -s /usr/bin/python3 /usr/bin/python
WORKDIR /app # split the sqlite install here, so that it can caches the arm prebuilt
RUN npm install sqlite3@5.0.2
COPY . . COPY . .
RUN npm install RUN npm install
RUN npm run build RUN npm run build

View file

@ -8,7 +8,7 @@
"build": "vite build", "build": "vite build",
"vite-preview-dist": "vite preview --host", "vite-preview-dist": "vite preview --host",
"build-docker": "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.0.3 . --push", "build-docker": "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.0.3 . --push",
"build-docker-nightly": "docker buildx build --platform linux/amd64 -t louislam/uptime-kuma:nightly . --push", "build-docker-nightly": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t louislam/uptime-kuma:nightly . --push",
"setup": "git checkout 1.0.3 && npm install && npm run build", "setup": "git checkout 1.0.3 && npm install && npm run build",
"version-global-replace": "node extra/version-global-replace.js" "version-global-replace": "node extra/version-global-replace.js"
}, },