Unverified Commit 4ca9a923 authored by David Mehren's avatar David Mehren Committed by GitHub

Merge pull request #245 from hedgedoc/1.9-staging

Release 1.9.0
parents f0f6c465 7ad3ee76
...@@ -11,7 +11,7 @@ jobs: ...@@ -11,7 +11,7 @@ jobs:
base: [debian, alpine] base: [debian, alpine]
env: env:
# renovate: datasource=github-tags depName=hedgedoc/hedgedoc versioning=semver # renovate: datasource=github-tags depName=hedgedoc/hedgedoc versioning=semver
HEDGEDOC_VERSION: 1.8.2 HEDGEDOC_VERSION: 1.9.0
HEDGEDOC_IMAGE: quay.io/hedgedoc/hedgedoc HEDGEDOC_IMAGE: quay.io/hedgedoc/hedgedoc
steps: steps:
- name: Checkout - name: Checkout
......
FROM node:16.9.1-alpine@sha256:2493168624ba845497ae71433a929c58a225e72c4a01b3809f3f4d559c09234b AS base FROM node:16.9.1-alpine@sha256:2493168624ba845497ae71433a929c58a225e72c4a01b3809f3f4d559c09234b AS base
FROM base AS basebuilder FROM base AS builder
RUN apk update
FROM basebuilder AS dockerize
# Download and extract dockerize, used in resources/docker-entrypoint.sh
ENV DOCKERIZE_VERSION=v0.6.1
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
RUN tar -xzvf dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
RUN rm dockerize-alpine-linux-amd64-$DOCKERIZE_VERSION.tar.gz
FROM basebuilder AS builder
# Build arguments to change source url, branch or tag # Build arguments to change source url, branch or tag
ARG CODIMD_REPOSITORY ARG CODIMD_REPOSITORY
ARG HEDGEDOC_REPOSITORY=https://github.com/hedgedoc/hedgedoc.git ARG HEDGEDOC_REPOSITORY=https://github.com/hedgedoc/hedgedoc.git
...@@ -19,7 +8,7 @@ ARG VERSION=master ...@@ -19,7 +8,7 @@ ARG VERSION=master
RUN if [ -n "${CODIMD_REPOSITORY}" ]; then echo "CODIMD_REPOSITORY is deprecated. Please use HEDGEDOC_REPOSITORY instead" && exit 1; fi RUN if [ -n "${CODIMD_REPOSITORY}" ]; then echo "CODIMD_REPOSITORY is deprecated. Please use HEDGEDOC_REPOSITORY instead" && exit 1; fi
# Clone the source and remove git repository but keep the HEAD file # Clone the source and remove git repository but keep the HEAD file
RUN apk add git jq RUN apk update && apk add git jq
RUN git clone --depth 1 --branch "$VERSION" "$HEDGEDOC_REPOSITORY" /hedgedoc RUN git clone --depth 1 --branch "$VERSION" "$HEDGEDOC_REPOSITORY" /hedgedoc
RUN git -C /hedgedoc log --pretty=format:'%ad %h %d' --abbrev-commit --date=short -1 RUN git -C /hedgedoc log --pretty=format:'%ad %h %d' --abbrev-commit --date=short -1
RUN git -C /hedgedoc rev-parse HEAD > /tmp/gitref RUN git -C /hedgedoc rev-parse HEAD > /tmp/gitref
...@@ -32,7 +21,6 @@ RUN mv /hedgedoc/package.new.json /hedgedoc/package.json ...@@ -32,7 +21,6 @@ RUN mv /hedgedoc/package.new.json /hedgedoc/package.json
WORKDIR /hedgedoc WORKDIR /hedgedoc
RUN yarn install --production=false --pure-lockfile RUN yarn install --production=false --pure-lockfile
RUN yarn run build RUN yarn run build
RUN rm -rf node_modules
RUN yarn install --production=true --pure-lockfile RUN yarn install --production=true --pure-lockfile
...@@ -40,12 +28,15 @@ FROM base ...@@ -40,12 +28,15 @@ FROM base
ARG UID=10000 ARG UID=10000
ENV NODE_ENV=production ENV NODE_ENV=production
COPY --from=dockerize dockerize /usr/local/bin/
COPY --chown=$UID --from=builder /hedgedoc /hedgedoc COPY --chown=$UID --from=builder /hedgedoc /hedgedoc
# Add configuraton files # Add configuraton files
COPY ["resources/config.json", "/files/"] COPY ["resources/config.json", "/files/"]
# Healthcheck
COPY --chown=$UID /resources/healthcheck.mjs /hedgedoc/healthcheck.mjs
HEALTHCHECK --interval=5s CMD node healthcheck.mjs
# For backwards compatibility # For backwards compatibility
RUN ln -s /hedgedoc /codimd RUN ln -s /hedgedoc /codimd
...@@ -65,4 +56,4 @@ EXPOSE 3000 ...@@ -65,4 +56,4 @@ EXPOSE 3000
COPY ["resources/docker-entrypoint.sh", "/usr/local/bin/docker-entrypoint.sh"] COPY ["resources/docker-entrypoint.sh", "/usr/local/bin/docker-entrypoint.sh"]
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["npm", "start"] CMD ["node", "app.js"]
FROM node:16.9.1-slim@sha256:42c5f3500ec7ea98adb2f00f60dd3e9c8cc4f5b66838ec7f9f2bcebdb4f20989 AS base FROM node:16.9.1-slim@sha256:42c5f3500ec7ea98adb2f00f60dd3e9c8cc4f5b66838ec7f9f2bcebdb4f20989 AS base
FROM base AS basebuilder FROM base AS builder
RUN apt-get update
FROM basebuilder AS dockerize
# Download and extract dockerize, used in resources/docker-entrypoint.sh
ENV DOCKERIZE_VERSION=v0.6.1
RUN apt-get install --no-install-recommends -y ca-certificates wget
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
RUN tar -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
RUN rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
FROM basebuilder AS builder
# Build arguments to change source url, branch or tag # Build arguments to change source url, branch or tag
ARG CODIMD_REPOSITORY ARG CODIMD_REPOSITORY
ARG HEDGEDOC_REPOSITORY=https://github.com/hedgedoc/hedgedoc.git ARG HEDGEDOC_REPOSITORY=https://github.com/hedgedoc/hedgedoc.git
...@@ -20,7 +8,7 @@ ARG VERSION=master ...@@ -20,7 +8,7 @@ ARG VERSION=master
RUN if [ -n "${CODIMD_REPOSITORY}" ]; then echo "CODIMD_REPOSITORY is deprecated. Please use HEDGEDOC_REPOSITORY instead" && exit 1; fi RUN if [ -n "${CODIMD_REPOSITORY}" ]; then echo "CODIMD_REPOSITORY is deprecated. Please use HEDGEDOC_REPOSITORY instead" && exit 1; fi
# Clone the source and remove git repository but keep the HEAD file # Clone the source and remove git repository but keep the HEAD file
RUN apt-get install --no-install-recommends -y git jq ca-certificates RUN apt-get update && apt-get install --no-install-recommends -y git jq ca-certificates
RUN git clone --depth 1 --branch "$VERSION" "$HEDGEDOC_REPOSITORY" /hedgedoc RUN git clone --depth 1 --branch "$VERSION" "$HEDGEDOC_REPOSITORY" /hedgedoc
RUN git -C /hedgedoc log --pretty=format:'%ad %h %d' --abbrev-commit --date=short -1 RUN git -C /hedgedoc log --pretty=format:'%ad %h %d' --abbrev-commit --date=short -1
RUN git -C /hedgedoc rev-parse HEAD > /tmp/gitref RUN git -C /hedgedoc rev-parse HEAD > /tmp/gitref
...@@ -30,11 +18,9 @@ RUN jq ".repository.url = \"${HEDGEDOC_REPOSITORY}\"" /hedgedoc/package.json > / ...@@ -30,11 +18,9 @@ RUN jq ".repository.url = \"${HEDGEDOC_REPOSITORY}\"" /hedgedoc/package.json > /
RUN mv /hedgedoc/package.new.json /hedgedoc/package.json RUN mv /hedgedoc/package.new.json /hedgedoc/package.json
# Install app dependencies and build # Install app dependencies and build
RUN apt-get install --no-install-recommends -y bzip2
WORKDIR /hedgedoc WORKDIR /hedgedoc
RUN yarn install --production=false --pure-lockfile RUN yarn install --production=false --pure-lockfile
RUN yarn run build RUN yarn run build
RUN rm -rf node_modules
RUN yarn install --production=true --pure-lockfile RUN yarn install --production=true --pure-lockfile
...@@ -43,15 +29,18 @@ ARG UID=10000 ...@@ -43,15 +29,18 @@ ARG UID=10000
ENV NODE_ENV=production ENV NODE_ENV=production
RUN apt-get update && \ RUN apt-get update && \
apt-get install --no-install-recommends -y fonts-noto gosu && \ apt-get install --no-install-recommends -y gosu && \
rm -r /var/lib/apt/lists/* rm -r /var/lib/apt/lists/*
COPY --from=dockerize dockerize /usr/local/bin/
COPY --chown=$UID --from=builder /hedgedoc /hedgedoc COPY --chown=$UID --from=builder /hedgedoc /hedgedoc
# Add configuraton files # Add configuraton files
COPY ["resources/config.json", "/files/"] COPY ["resources/config.json", "/files/"]
# Healthcheck
COPY --chown=$UID /resources/healthcheck.mjs /hedgedoc/healthcheck.mjs
HEALTHCHECK --interval=5s CMD node healthcheck.mjs
# For backwards compatibility # For backwards compatibility
RUN ln -s /hedgedoc /codimd RUN ln -s /hedgedoc /codimd
...@@ -69,4 +58,4 @@ COPY ["resources/docker-entrypoint.sh", "/usr/local/bin/docker-entrypoint.sh"] ...@@ -69,4 +58,4 @@ COPY ["resources/docker-entrypoint.sh", "/usr/local/bin/docker-entrypoint.sh"]
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["npm", "start"] CMD ["node", "app.js"]
...@@ -53,7 +53,7 @@ services: ...@@ -53,7 +53,7 @@ services:
# args: # args:
# - "VERSION=master" # - "VERSION=master"
# - "HEDGEDOC_REPOSITORY=https://github.com/hedgedoc/hedgedoc.git" # - "HEDGEDOC_REPOSITORY=https://github.com/hedgedoc/hedgedoc.git"
image: quay.io/hedgedoc/hedgedoc:1.8.2 image: quay.io/hedgedoc/hedgedoc:1.9.0
#mem_limit: 256mb # version 2 only #mem_limit: 256mb # version 2 only
#memswap_limit: 512mb # version 2 only #memswap_limit: 512mb # version 2 only
#read_only: true # not supported in swarm mode, enable along with tmpfs #read_only: true # not supported in swarm mode, enable along with tmpfs
......
...@@ -4,32 +4,10 @@ ...@@ -4,32 +4,10 @@
UID="$(id -u)" UID="$(id -u)"
[ "$UID" -eq 0 ] && GOSU="gosu hedgedoc" || GOSU="" [ "$UID" -eq 0 ] && GOSU="gosu hedgedoc" || GOSU=""
if [ "$HMD_DB_URL" != "" ] && [ "$CMD_DB_URL" = "" ]; then
CMD_DB_URL="$HMD_DB_URL"
fi
if [ "$HMD_IMAGE_UPLOAD_TYPE" != "" ] && [ "$CMD_IMAGE_UPLOAD_TYPE" = "" ]; then if [ "$HMD_IMAGE_UPLOAD_TYPE" != "" ] && [ "$CMD_IMAGE_UPLOAD_TYPE" = "" ]; then
CMD_IMAGE_UPLOAD_TYPE="$HMD_IMAGE_UPLOAD_TYPE" CMD_IMAGE_UPLOAD_TYPE="$HMD_IMAGE_UPLOAD_TYPE"
fi fi
DOCKER_SECRET_DB_URL_FILE_PATH="/run/secrets/dbURL"
if [ -f "$DOCKER_SECRET_DB_URL_FILE_PATH" ]; then
CMD_DB_URL="$(cat $DOCKER_SECRET_DB_URL_FILE_PATH)"
fi
if [ "$CMD_DB_URL" = "" ]; then
CMD_DB_URL="postgres://hedgedoc:password@database:5432/hedgedoc"
fi
export CMD_DB_URL
DB_SOCKET=$(echo ${CMD_DB_URL} | sed -e 's/.*:\/\//\/\//' -e 's/.*\/\/[^@]*@//' -e 's/\/.*$//')
if [ "$DB_SOCKET" != "" ]; then
dockerize -wait "tcp://${DB_SOCKET}" -timeout 30s
fi
# Print warning if local data storage is used but no volume is mounted # Print warning if local data storage is used but no volume is mounted
[ "$CMD_IMAGE_UPLOAD_TYPE" = "filesystem" ] && { mountpoint -q ./public/uploads || { [ "$CMD_IMAGE_UPLOAD_TYPE" = "filesystem" ] && { mountpoint -q ./public/uploads || {
echo " echo "
......
import fetch from 'node-fetch'
// Kill myself after 5 second timeout
setTimeout(() => {
process.exit(1)
}, 5000)
fetch(`http://localhost:${process.env.CMD_PORT || '3000' }/status`).then((response) => {
if (!response.ok) {
process.exit(1)
}
process.exit(0)
}).catch(() => {
process.exit(1)
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment