Skip to content

Commit 1ad45f6

Browse files
authored
Merge pull request #35 from TIBCO-Hub-Backstage/main
Released tibco-developer-hub version 1.4.0
2 parents e265596 + 4d58301 commit 1ad45f6

File tree

34 files changed

+71985
-62233
lines changed

34 files changed

+71985
-62233
lines changed

.gitignore

Lines changed: 22 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#yarn files
2-
.yarn/
3-
.yarnrc.yml
1+
# macOS
2+
.DS_Store
43

54
# Logs
65
logs
@@ -10,107 +9,30 @@ yarn-debug.log*
109
yarn-error.log*
1110
lerna-debug.log*
1211

13-
# Diagnostic reports (https://nodejs.org/api/report.html)
14-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
15-
16-
# Runtime data
17-
pids
18-
*.pid
19-
*.seed
20-
*.pid.lock
21-
22-
# Directory for instrumented libs generated by jscoverage/JSCover
23-
lib-cov
24-
25-
# Coverage directory used by tools like istanbul
12+
# Coverage directory generated when running tests with coverage
2613
coverage
27-
*.lcov
28-
29-
# nyc test coverage
30-
.nyc_output
31-
32-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
33-
.grunt
34-
35-
# Bower dependency directory (https://bower.io/)
36-
bower_components
37-
38-
# node-waf configuration
39-
.lock-wscript
4014

41-
# Compiled binary addons (https://nodejs.org/api/addons.html)
42-
build/Release
43-
44-
# Dependency directories
15+
# Dependencies
4516
node_modules/
46-
jspm_packages/
47-
node_modules
48-
49-
# TypeScript v1 declaration files
50-
typings/
51-
52-
# TypeScript cache
53-
*.tsbuildinfo
54-
55-
# Optional npm cache directory
56-
.npm
57-
58-
# Optional eslint cache
59-
.eslintcache
6017

61-
# Microbundle cache
62-
.rpt2_cache/
63-
.rts2_cache_cjs/
64-
.rts2_cache_es/
65-
.rts2_cache_umd/
18+
# Yarn files
19+
.pnp.*
20+
.yarn/*
21+
!.yarn/patches
22+
!.yarn/plugins
23+
!.yarn/releases
24+
!.yarn/sdks
25+
!.yarn/versions
6626

67-
# Optional REPL history
68-
.node_repl_history
69-
70-
# Output of 'npm pack'
71-
*.tgz
72-
73-
# Yarn Integrity file
74-
.yarn-integrity
27+
# Node version directives
28+
.nvmrc
7529

7630
# dotenv environment variables file
7731
.env
7832
.env.test
7933

80-
# parcel-bundler cache (https://parceljs.org/)
81-
.cache
82-
83-
# Next.js build output
84-
.next
85-
86-
# Nuxt.js build / generate output
87-
.nuxt
34+
# Build output
8835
dist
89-
90-
# Gatsby files
91-
.cache/
92-
# Comment in the public line in if your project uses Gatsby and *not* Next.js
93-
# https://nextjs.org/blog/next-9-1#public-directory-support
94-
# public
95-
96-
# vuepress build output
97-
.vuepress/dist
98-
99-
# Serverless directories
100-
.serverless/
101-
102-
# FuseBox cache
103-
.fusebox/
104-
105-
# DynamoDB Local files
106-
.dynamodb/
107-
108-
# TernJS port file
109-
.tern-port
110-
111-
112-
# macOS
113-
.DS_Store
11436
dist-types
11537

11638
# Temporary change files created by Vim
@@ -125,6 +47,12 @@ site
12547
# Sensitive credentials
12648
*-credentials.yaml
12749

50+
# vscode database functionality support files
51+
*.session.sql
52+
53+
# E2E test reports
54+
e2e-test-report/
55+
12856
# vscode
12957
.vscode/*
13058
!.vscode/tasks.json
@@ -139,6 +67,4 @@ environment.sh
13967
*.environment.sh
14068

14169
.idea
142-
# E2E test reports
143-
e2e-test-report/
144-
/.vscode/
70+

.yarn/releases/yarn-4.4.1.cjs

Lines changed: 925 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
nodeLinker: node-modules
2+
3+
yarnPath: .yarn/releases/yarn-4.4.1.cjs

Dockerfile

Lines changed: 81 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1+
# Build Python environment in a separate builder stage
2+
FROM cgr.dev/chainguard/python@sha256:3d576a0d94b05c0da7fba83c8dbf1d909a61a95132d3f65b409b3eb01bf18633 as python-builder
3+
4+
ENV PATH=/venv/bin:$PATH
5+
6+
RUN --mount=type=cache,target=/home/nonroot/.cache/pip,uid=65532,gid=65532 \
7+
python3 -m venv /home/nonroot/venv && \
8+
/home/nonroot/venv/bin/pip install mkdocs-techdocs-core==1.3.3 && \
9+
/home/nonroot/venv/bin/pip install setuptools
10+
111
# Stage 1 - Create yarn install skeleton layer
2-
FROM node:18.20-alpine3.19 AS packages
12+
FROM cgr.dev/chainguard/wolfi-base@sha256:2148be123cd047f10c93e2bc88010d4abba1fc56a367d6287a251099ed5f006a AS packages
313

414
WORKDIR /app
515
COPY package.json yarn.lock ./
16+
COPY .yarn ./.yarn
17+
COPY .yarnrc.yml ./
18+
619

720
COPY packages packages
821

@@ -11,83 +24,101 @@ COPY plugins plugins
1124

1225
RUN find packages \! -name "package.json" -mindepth 2 -maxdepth 2 -exec rm -rf {} \+
1326

14-
# Stage 2 - Install dependencies and build packages
15-
FROM node:18.20-alpine3.19 AS build
27+
FROM cgr.dev/chainguard/wolfi-base@sha256:2148be123cd047f10c93e2bc88010d4abba1fc56a367d6287a251099ed5f006a as build
28+
29+
ENV NODE_VERSION="18=~18.20"
1630

17-
RUN --mount=type=cache,target=/var/cache/apk,sharing=locked \
18-
--mount=type=cache,target=/var/lib/apk,sharing=locked \
31+
RUN --mount=type=cache,target=/var/cache/apk,sharing=locked,uid=65532,gid=65532 \
32+
--mount=type=cache,target=/var/lib/apk,sharing=locked,uid=65532,gid=65532 \
1933
apk update && \
20-
apk add python3 g++ make && \
21-
yarn config set python /usr/bin/python3
34+
apk add nodejs-$NODE_VERSION yarn \
35+
# Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend.
36+
openssl-dev brotli-dev c-ares-dev nghttp2-dev icu-dev zlib-dev gcc-12 libuv-dev build-base
2237

23-
USER node
2438
WORKDIR /app
39+
RUN chown -R nonroot:nonroot /app
2540

26-
COPY --from=packages --chown=node:node /app .
41+
RUN mkdir -p /home/nonroot/.yarn/berry && chown -R 65532:65532 /home/nonroot/.yarn/berry
2742

28-
RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \
29-
yarn install --frozen-lockfile --network-timeout 600000
43+
USER nonroot
3044

31-
COPY --chown=node:node . .
45+
COPY --from=packages --chown=65532:65532 /app .
46+
COPY --from=packages --chown=65532:65532 /app/.yarn ./.yarn
47+
COPY --from=packages --chown=65532:65532 /app/.yarnrc.yml ./
48+
49+
RUN --mount=type=cache,target=/home/nonroot/.yarn/berry/cache,sharing=locked,uid=65532,gid=65532 \
50+
yarn install --immutable
51+
52+
COPY --chown=65532:65532 . .
3253

3354
RUN yarn tsc
3455
RUN yarn --cwd packages/backend build
35-
# If you have not yet migrated to package roles, use the following command instead:
36-
# RUN yarn --cwd packages/backend backstage-cli backend:bundle --build-dependencies
56+
3757

3858
RUN mkdir packages/backend/dist/skeleton packages/backend/dist/bundle \
3959
&& tar xzf packages/backend/dist/skeleton.tar.gz -C packages/backend/dist/skeleton \
4060
&& tar xzf packages/backend/dist/bundle.tar.gz -C packages/backend/dist/bundle
4161

42-
# Stage 3 - Build the actual backend image and install production dependencies
43-
FROM --platform=linux/amd64 chainguard/wolfi-base
44-
45-
ENV NODE_VERSION 18=~18.20
46-
ENV PYTHON_VERSION 3.12=~3.12
62+
FROM cgr.dev/chainguard/wolfi-base@sha256:2148be123cd047f10c93e2bc88010d4abba1fc56a367d6287a251099ed5f006a as node-builder
4763

48-
RUN apk update && apk add nodejs-$NODE_VERSION yarn
64+
ENV NODE_VERSION="18=~18.20"
4965

50-
# Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image,
51-
# in which case you should also move better-sqlite3 to "devDependencies" in package.json.
52-
# Additionally, we install dependencies for `techdocs.generator.runIn: local`.
53-
# https://backstage.io/docs/features/techdocs/getting-started#disabling-docker-in-docker-situation-optional
54-
RUN --mount=type=cache,target=/var/cache/apk,sharing=locked \
55-
--mount=type=cache,target=/var/lib/apk,sharing=locked \
66+
RUN --mount=type=cache,target=/var/cache/apk,sharing=locked,uid=65532,gid=65532 \
67+
--mount=type=cache,target=/var/lib/apk,sharing=locked,uid=65532,gid=65532 \
5668
apk update && \
57-
apk add python-$PYTHON_VERSION make py3-pip python-3-dev py3-setuptools build-base gcc libffi-dev glibc-dev openssl-dev brotli-dev c-ares-dev nghttp2-dev icu-dev zlib-dev gcc-12 libuv-dev && \
58-
yarn config set python /usr/bin/python3
69+
apk add nodejs-$NODE_VERSION yarn \
70+
# Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend.
71+
openssl-dev brotli-dev c-ares-dev nghttp2-dev icu-dev zlib-dev gcc-12 libuv-dev build-base
5972

60-
# Set up a virtual environment for mkdocs-techdocs-core.
61-
ENV VIRTUAL_ENV=/opt/venv
62-
RUN python3 -m venv $VIRTUAL_ENV
63-
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
64-
RUN pip3 install setuptools
73+
WORKDIR /app
74+
RUN chown -R nonroot:nonroot /app
6575

66-
RUN pip3 install mkdocs-techdocs-core==1.3.3
76+
RUN mkdir -p /home/nonroot/.yarn/berry && chown -R 65532:65532 /home/nonroot/.yarn/berry
6777

68-
WORKDIR /app
69-
# Copy the install dependencies from the build stage and context
70-
COPY --from=build /app/yarn.lock /app/package.json /app/packages/backend/dist/skeleton/ ./
78+
USER nonroot
79+
80+
COPY --from=build --chown=65532:65532 /app/.yarn ./.yarn
81+
COPY --from=build --chown=65532:65532 /app/.yarnrc.yml ./
7182

72-
RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \
73-
yarn install --frozen-lockfile --production --network-timeout 600000
83+
COPY --from=build --chown=65532:65532 /app/yarn.lock /app/package.json /app/packages/backend/dist/skeleton/ ./
7484

75-
# Copy the built packages from the build stage
76-
COPY --from=build /app/packages/backend/dist/bundle/ ./
85+
RUN --mount=type=cache,target=/home/nonroot/.yarn/berry/cache,sharing=locked,uid=65532,gid=65532 \
86+
yarn workspaces focus --all --production && yarn cache clean --all
7787

78-
# Copy any other files that we need at runtime
79-
COPY app-config.yaml app-config.production.yaml ./
88+
FROM --platform=linux/amd64 cgr.dev/chainguard/wolfi-base@sha256:2148be123cd047f10c93e2bc88010d4abba1fc56a367d6287a251099ed5f006a
8089

90+
ENV PYTHON_VERSION="3.12=~3.12"
91+
ENV NODE_VERSION="18=~18.20"
92+
ENV NODE_ENV=production
93+
94+
RUN --mount=type=cache,target=/var/cache/apk,sharing=locked,uid=65532,gid=65532 \
95+
--mount=type=cache,target=/var/lib/apk,sharing=locked,uid=65532,gid=65532 \
96+
apk update && \
97+
apk add \
98+
# add node for backstage
99+
nodejs-$NODE_VERSION \
100+
# add python for backstage techdocs
101+
python-$PYTHON_VERSION \
102+
# add tini for init process
103+
tini
104+
105+
WORKDIR /app
106+
107+
COPY package.json app-config.yaml app-config.production.yaml ./
81108
# Copy license file
82109
COPY LICENSE.TXT /opt/tibco/license/
83110

84-
# This switches many Node.js dependencies to production mode.
85-
ENV NODE_ENV production
86-
ENV HUB_CONFIGFILE "app-config.production.yaml"
111+
RUN chown -R 65532:65532 /app
112+
RUN chown -R 65532:65532 /tmp
113+
USER 65532:65532
114+
115+
COPY --from=build --chown=65532:65532 /app/packages/backend/dist/bundle/ ./
116+
COPY --from=node-builder --chown=65532:65532 /app/node_modules ./node_modules
117+
COPY --from=python-builder --chown=65532:65532 /home/nonroot/venv /home/nonroot/venv
118+
ENV PATH=/home/nonroot/venv/bin:$PATH
87119

88-
ARG BID
89-
ENV APP_CONFIG_app_buildVersion="${BID}"
120+
ENV GIT_PYTHON_REFRESH="quiet"
90121

91-
RUN chmod -R 777 /app/node_modules/@backstage/plugin-techdocs-backend
122+
ENTRYPOINT ["tini", "--"]
92123

93-
CMD node packages/backend --config "${HUB_CONFIGFILE}"
124+
CMD ["node", "packages/backend", "--config", "app-config.production.yaml"]

0 commit comments

Comments
 (0)