mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-27 13:34:28 -04:00
misc: add turbo monorepo util
Co-authored-by: Tilman Vatteroth <git@tilmanvatteroth.de> Co-authored-by: David Mehren <git@herrmehren.de> Co-authored-by: Erik Michelson <github@erik.michelson.eu> Signed-off-by: Erik Michelson <github@erik.michelson.eu> Signed-off-by: David Mehren <git@herrmehren.de> Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
e3512d3a87
commit
305b6f5910
41 changed files with 785 additions and 1218 deletions
|
@ -1,7 +0,0 @@
|
|||
Dockerfile
|
||||
.dockerignore
|
||||
node_modules
|
||||
npm-debug.log
|
||||
README.md
|
||||
.next
|
||||
.git
|
|
@ -1,3 +0,0 @@
|
|||
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: CC0-1.0
|
|
@ -1,3 +1,2 @@
|
|||
NEXT_PUBLIC_USE_MOCK_API=true
|
||||
HD_BASE_URL="http://localhost:3001/"
|
||||
HD_RENDERER_BASE_URL="http://127.0.0.1:3001/"
|
||||
HD_BASE_URL="http://localhost:8080/"
|
||||
HD_RENDERER_BASE_URL="http://127.0.0.1:8080/"
|
||||
|
|
|
@ -2,8 +2,15 @@
|
|||
#
|
||||
# SPDX-License-Identifier: CC-BY-SA-4.0
|
||||
|
||||
# BASE
|
||||
FROM docker.io/node:18-alpine@sha256:bc329c7332cffc30c2d4801e38df03cbfa8dcbae2a7a52a449db104794f168a3 AS base
|
||||
RUN apk add --no-cache tini
|
||||
ENTRYPOINT ["tini", "--"]
|
||||
|
||||
# BUILD
|
||||
FROM docker.io/node:18-alpine@sha256:bc329c7332cffc30c2d4801e38df03cbfa8dcbae2a7a52a449db104794f168a3 AS builder
|
||||
FROM base AS builder
|
||||
|
||||
RUN apk add --no-cache libc6-compat
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
ARG BUILD_VERSION=CLIENT_VERSION_MISSING
|
||||
|
@ -12,31 +19,21 @@ ENV YARN_CACHE_FOLDER /tmp/.yarn
|
|||
USER node
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
COPY --chown=node .yarn/plugins .yarn/plugins
|
||||
COPY --chown=node .yarn/patches .yarn/patches
|
||||
COPY --chown=node .yarn/releases .yarn/releases
|
||||
COPY --chown=node .yarnrc.yml .yarnrc.yml
|
||||
COPY --chown=node package.json package.json
|
||||
COPY --chown=node yarn.lock yarn.lock
|
||||
COPY --chown=node backend/package.json backend/
|
||||
COPY --chown=node commons commons
|
||||
COPY --chown=node frontend frontend
|
||||
COPY --chown=node . .
|
||||
RUN --mount=type=cache,sharing=locked,uid=1000,gid=1000,target=/tmp/.yarn \
|
||||
yarn install --immutable && yarn workspaces focus @hedgedoc/frontend
|
||||
yarn install --immutable && yarn workspaces focus hedgedoc @hedgedoc/backend @hedgedoc/commons
|
||||
|
||||
WORKDIR /usr/src/app/commons
|
||||
ARG TURBO_TEAM
|
||||
ARG TURBO_API
|
||||
ARG TURBO_TOKEN
|
||||
|
||||
RUN yarn build
|
||||
|
||||
WORKDIR /usr/src/app/frontend
|
||||
|
||||
RUN rm -rf public/public && \
|
||||
rm -rf src/pages/api && \
|
||||
sed -i "s/CLIENT_VERSION_MISSING/${BUILD_VERSION}/" src/version.json
|
||||
RUN yarn build
|
||||
RUN rm -rf frontend/public/public
|
||||
RUN rm -rf frontend/src/pages/api
|
||||
RUN sed -i "s/CLIENT_VERSION_MISSING/${BUILD_VERSION}/" frontend/src/version.json
|
||||
RUN yarn turbo run build --filter=frontend --no-cache --no-daemon
|
||||
|
||||
# RUNNER
|
||||
FROM docker.io/node:18-alpine@sha256:bc329c7332cffc30c2d4801e38df03cbfa8dcbae2a7a52a449db104794f168a3
|
||||
FROM base
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
|
|
|
@ -8,20 +8,21 @@
|
|||
"build:mock": "cross-env NEXT_PUBLIC_USE_MOCK_API=true next build",
|
||||
"build:test": "cross-env NODE_ENV=test NEXT_PUBLIC_TEST_MODE=true next build",
|
||||
"analyze": "cross-env ANALYZE=true yarn build",
|
||||
"dev": "cross-env PORT=3001 next dev",
|
||||
"dev:test": "cross-env PORT=3001 NODE_ENV=test NEXT_PUBLIC_TEST_MODE=true next dev",
|
||||
"dev:with-local-backend": "cross-env PORT=3001 NEXT_PUBLIC_USE_MOCK_API=false HD_BASE_URL=http://localhost:8080/ HD_RENDERER_BASE_URL=http://localhost:8080/ next dev",
|
||||
"format": "prettier -c \"src/**/*.{ts,tsx,js}\" \"cypress/**/*.{ts,tsx}\"",
|
||||
"format:fix": "prettier -w \"src/**/*.{ts,tsx,js}\" \"cypress/**/*.{ts,tsx}\"",
|
||||
"lint": "eslint --max-warnings=0 --ext .ts,.tsx src",
|
||||
"lint:fix": "eslint --fix --ext .ts,.tsx src",
|
||||
"start": "cross-env PORT=3001 next start",
|
||||
"start:ci": "cross-env NODE_ENV=test PORT=3001 next start",
|
||||
"cy:open": "cypress open",
|
||||
"cy:run:chrome": "cypress run --browser chrome",
|
||||
"cy:run:firefox": "cypress run --browser firefox",
|
||||
"test": "cross-env NODE_ENV=test jest --watch",
|
||||
"test:ci": "cross-env NODE_ENV=test jest --ci"
|
||||
"start:ci": "cross-env PORT=3001 NODE_ENV=test next start",
|
||||
"start:dev": "cross-env PORT=3001 next dev",
|
||||
"start:dev:mock": "cross-env PORT=3001 NEXT_PUBLIC_USE_MOCK_API=true HD_BASE_URL=\"http://localhost:3001/\" HD_RENDERER_BASE_URL=\"http://127.0.0.1:3001/\" next dev",
|
||||
"start:dev:test": "cross-env PORT=3001 NODE_ENV=test NEXT_PUBLIC_TEST_MODE=true next dev",
|
||||
"test:e2e:open": "cypress open",
|
||||
"test:e2e": "cypress run --browser chrome",
|
||||
"test:e2e:ci": "cypress run --browser chrome --record true --parallel --group \"chrome\"",
|
||||
"test:watch": "cross-env NODE_ENV=test jest --watch",
|
||||
"test:ci": "cross-env NODE_ENV=test jest --ci",
|
||||
"test": "cross-env NODE_ENV=test jest"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
||||
|
||||
SPDX-License-Identifier: CC0-1.0
|
Loading…
Add table
Add a link
Reference in a new issue