mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-06-15 17:06:48 +02:00
update dockerfile
This commit is contained in:
parent
71e0e87b3a
commit
638f2f05ca
4 changed files with 167 additions and 15829 deletions
|
@ -1,52 +0,0 @@
|
|||
FROM louislam/uptime-kuma:base-debian AS build
|
||||
WORKDIR /app
|
||||
|
||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
|
||||
|
||||
COPY . .
|
||||
RUN npm ci --production && \
|
||||
chmod +x /app/extra/entrypoint.sh
|
||||
|
||||
|
||||
FROM louislam/uptime-kuma:base-debian AS release
|
||||
WORKDIR /app
|
||||
|
||||
# Copy app files from build layer
|
||||
COPY --from=build /app /app
|
||||
|
||||
EXPOSE 3001
|
||||
VOLUME ["/app/data"]
|
||||
HEALTHCHECK --interval=60s --timeout=30s --start-period=180s --retries=5 CMD node extra/healthcheck.js
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--", "extra/entrypoint.sh"]
|
||||
CMD ["node", "server/server.js"]
|
||||
|
||||
|
||||
FROM release AS nightly
|
||||
RUN npm run mark-as-nightly
|
||||
|
||||
|
||||
# Upload the artifact to Github
|
||||
FROM louislam/uptime-kuma:base-debian AS upload-artifact
|
||||
WORKDIR /
|
||||
RUN apt update && \
|
||||
apt --yes install curl file
|
||||
|
||||
COPY --from=build /app /app
|
||||
|
||||
ARG VERSION
|
||||
ARG GITHUB_TOKEN
|
||||
ARG TARGETARCH
|
||||
ARG PLATFORM=debian
|
||||
ARG FILE=$PLATFORM-$TARGETARCH-$VERSION.tar.gz
|
||||
ARG DIST=dist.tar.gz
|
||||
|
||||
RUN chmod +x /app/extra/upload-github-release-asset.sh
|
||||
|
||||
# Full Build
|
||||
# RUN tar -zcvf $FILE app
|
||||
# RUN /app/extra/upload-github-release-asset.sh github_api_token=$GITHUB_TOKEN owner=louislam repo=uptime-kuma tag=$VERSION filename=$FILE
|
||||
|
||||
# Dist only
|
||||
RUN cd /app && tar -zcvf $DIST dist
|
||||
RUN /app/extra/upload-github-release-asset.sh github_api_token=$GITHUB_TOKEN owner=louislam repo=uptime-kuma tag=$VERSION filename=/app/$DIST
|
||||
|
52
dockerfile
Normal file
52
dockerfile
Normal file
|
@ -0,0 +1,52 @@
|
|||
FROM louislam/uptime-kuma:base-debian AS build
|
||||
WORKDIR /app
|
||||
|
||||
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
|
||||
|
||||
COPY . .
|
||||
RUN npm install
|
||||
RUN chmod +x /app/extra/entrypoint.sh
|
||||
|
||||
|
||||
FROM louislam/uptime-kuma:base-debian AS release
|
||||
WORKDIR /app
|
||||
|
||||
# Copy app files from build layer
|
||||
COPY --from=build /app /app
|
||||
|
||||
EXPOSE 3001
|
||||
VOLUME ["/app/data"]
|
||||
HEALTHCHECK --interval=60s --timeout=30s --start-period=180s --retries=5 CMD node extra/healthcheck.js
|
||||
ENTRYPOINT ["/usr/bin/dumb-init", "--", "extra/entrypoint.sh"]
|
||||
CMD ["node", "server/server.js"]
|
||||
|
||||
|
||||
# FROM release AS nightly
|
||||
# RUN npm run mark-as-nightly
|
||||
|
||||
|
||||
# # Upload the artifact to Github
|
||||
# FROM louislam/uptime-kuma:base-debian AS upload-artifact
|
||||
# WORKDIR /
|
||||
# RUN apt update && \
|
||||
# apt --yes install curl file
|
||||
|
||||
# COPY --from=build /app /app
|
||||
|
||||
# ARG VERSION
|
||||
# ARG GITHUB_TOKEN
|
||||
# ARG TARGETARCH
|
||||
# ARG PLATFORM=debian
|
||||
# ARG FILE=$PLATFORM-$TARGETARCH-$VERSION.tar.gz
|
||||
# ARG DIST=dist.tar.gz
|
||||
|
||||
# RUN chmod +x /app/extra/upload-github-release-asset.sh
|
||||
|
||||
# # Full Build
|
||||
# # RUN tar -zcvf $FILE app
|
||||
# # RUN /app/extra/upload-github-release-asset.sh github_api_token=$GITHUB_TOKEN owner=louislam repo=uptime-kuma tag=$VERSION filename=$FILE
|
||||
|
||||
# # Dist only
|
||||
# RUN cd /app && tar -zcvf $DIST dist
|
||||
# RUN /app/extra/upload-github-release-asset.sh github_api_token=$GITHUB_TOKEN owner=louislam repo=uptime-kuma tag=$VERSION filename=/app/$DIST
|
||||
|
|
@ -1,59 +1,58 @@
|
|||
console.log("Downloading dist");
|
||||
const https = require("https");
|
||||
const tar = require("tar");
|
||||
console.log('Downloading dist')
|
||||
const https = require('https')
|
||||
const tar = require('tar')
|
||||
|
||||
const packageJSON = require("../package.json");
|
||||
const fs = require("fs");
|
||||
const version = packageJSON.version;
|
||||
const packageJSON = require('../package.json')
|
||||
const fs = require('fs')
|
||||
const version = '1.13.0-beta.2'
|
||||
|
||||
const filename = "dist.tar.gz";
|
||||
const filename = 'dist.tar.gz'
|
||||
|
||||
const url = `https://github.com/louislam/uptime-kuma/releases/download/${version}/${filename}`;
|
||||
download(url);
|
||||
const url = `https://github.com/louislam/uptime-kuma/releases/download/${version}/${filename}`
|
||||
download(url)
|
||||
|
||||
function download(url) {
|
||||
console.log(url);
|
||||
function download (url) {
|
||||
console.log(url)
|
||||
|
||||
https.get(url, (response) => {
|
||||
if (response.statusCode === 200) {
|
||||
console.log("Extracting dist...");
|
||||
https.get(url, (response) => {
|
||||
if (response.statusCode === 200) {
|
||||
console.log('Extracting dist...')
|
||||
|
||||
if (fs.existsSync("./dist")) {
|
||||
|
||||
if (fs.existsSync("./dist-backup")) {
|
||||
fs.rmdirSync("./dist-backup", {
|
||||
recursive: true
|
||||
});
|
||||
}
|
||||
|
||||
fs.renameSync("./dist", "./dist-backup");
|
||||
}
|
||||
|
||||
const tarStream = tar.x({
|
||||
cwd: "./",
|
||||
});
|
||||
|
||||
tarStream.on("close", () => {
|
||||
if (fs.existsSync("./dist-backup")) {
|
||||
fs.rmdirSync("./dist-backup", {
|
||||
recursive: true
|
||||
});
|
||||
}
|
||||
console.log("Done");
|
||||
});
|
||||
|
||||
tarStream.on("error", () => {
|
||||
if (fs.existsSync("./dist-backup")) {
|
||||
fs.renameSync("./dist-backup", "./dist");
|
||||
}
|
||||
console.error("Error from tarStream");
|
||||
});
|
||||
|
||||
response.pipe(tarStream);
|
||||
} else if (response.statusCode === 302) {
|
||||
download(response.headers.location);
|
||||
} else {
|
||||
console.log("dist not found");
|
||||
if (fs.existsSync('./dist')) {
|
||||
if (fs.existsSync('./dist-backup')) {
|
||||
fs.rmdirSync('./dist-backup', {
|
||||
recursive: true
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
fs.renameSync('./dist', './dist-backup')
|
||||
}
|
||||
|
||||
const tarStream = tar.x({
|
||||
cwd: './'
|
||||
})
|
||||
|
||||
tarStream.on('close', () => {
|
||||
if (fs.existsSync('./dist-backup')) {
|
||||
fs.rmdirSync('./dist-backup', {
|
||||
recursive: true
|
||||
})
|
||||
}
|
||||
console.log('Done')
|
||||
})
|
||||
|
||||
tarStream.on('error', () => {
|
||||
if (fs.existsSync('./dist-backup')) {
|
||||
fs.renameSync('./dist-backup', './dist')
|
||||
}
|
||||
console.error('Error from tarStream')
|
||||
})
|
||||
|
||||
response.pipe(tarStream)
|
||||
} else if (response.statusCode === 302) {
|
||||
download(response.headers.location)
|
||||
} else {
|
||||
console.log('dist not found')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
15791
package-lock.json
generated
15791
package-lock.json
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue