Skip to content

Commit e3555cc

Browse files
committed
UPD: fix config files
1 parent 03d0965 commit e3555cc

File tree

16 files changed

+77
-249
lines changed

16 files changed

+77
-249
lines changed

.github/workflows/ci-workflow.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
node-version: ['18.x', '20.x']
16+
node-version: ['20.x', '22.x']
1717

1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v4
2020
with:
2121
fetch-depth: 0
2222

2323
- name: Set up Node.js
24-
uses: actions/setup-node@v2
24+
uses: actions/setup-node@v4
2525
with:
2626
node-version: ${{ matrix.node-version }}
2727
cache: 'yarn'
@@ -44,7 +44,7 @@ jobs:
4444
validate_commit_messages:
4545
runs-on: ubuntu-latest
4646
steps:
47-
- uses: actions/checkout@v2
47+
- uses: actions/checkout@v4
4848
with:
4949
fetch-depth: 0
5050
- name: Ensure full git history
@@ -73,7 +73,7 @@ jobs:
7373
validate_branch_names:
7474
runs-on: ubuntu-latest
7575
steps:
76-
- uses: actions/checkout@v2
76+
- uses: actions/checkout@v4
7777
- name: Validate Branch Names
7878
run: |
7979
if [ "${{ github.event_name }}" == "pull_request" ]; then

Dockerfile

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,63 @@
11
# Stage 1 - Create yarn install skeleton layer
22
FROM node:20-bookworm-slim AS packages
33

4+
# Enable Corepack (for Yarn management) and install the required Yarn version
5+
RUN corepack enable
6+
47
WORKDIR /app
5-
COPY package.json yarn.lock ./
8+
COPY backstage.json package.json yarn.lock ./
9+
COPY .yarn ./.yarn
10+
COPY .yarnrc.yml ./
11+
612

713
COPY packages packages
814

915
# Comment this out if you don't have any internal plugins
10-
# COPY plugins plugins
16+
COPY plugins plugins
1117

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

1420
# Stage 2 - Install dependencies and build packages
1521
FROM node:20-bookworm-slim AS build
1622

23+
# Set Python interpreter for `node-gyp` to use
24+
ENV PYTHON=/usr/bin/python3
25+
1726
# Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend.
1827
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
1928
--mount=type=cache,target=/var/lib/apt,sharing=locked \
2029
apt-get update && \
2130
apt-get install -y --no-install-recommends python3 g++ build-essential && \
22-
yarn config set python /usr/bin/python3
31+
rm -rf /var/lib/apt/lists/*
32+
33+
# Enable Corepack (for Yarn management) and install the required Yarn version
34+
RUN corepack enable
2335

2436
USER node
37+
38+
ENV DOCKER_BUILDKIT=1
39+
2540
WORKDIR /app
2641

2742
COPY --from=packages --chown=node:node /app .
43+
COPY --from=packages --chown=node:node /app/.yarn ./.yarn
44+
COPY --from=packages --chown=node:node /app/.yarnrc.yml ./
45+
COPY --from=packages --chown=node:node /app/backstage.json ./
2846

47+
# Pre-create and fix ownership for cache directory
48+
RUN mkdir -p /home/node/.cache/node/corepack/v1 && \
49+
chown -R node:node /home/node/.cache
50+
51+
#ENV CYPRESS_INSTALL_BINARY=0
52+
#RUN yarn install --immutable --network-timeout 600000
2953
RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \
30-
yarn install --frozen-lockfile --network-timeout 600000
54+
yarn install --immutable
3155

3256
COPY --chown=node:node . .
3357

34-
RUN ls
58+
#RUN ls
3559

36-
RUN ls /app
60+
#RUN ls /app
3761

3862
RUN yarn tsc
3963
RUN yarn --cwd packages/backend build
@@ -47,16 +71,25 @@ RUN mkdir packages/backend/dist/skeleton packages/backend/dist/bundle \
4771
# Stage 3 - Build the actual backend image and install production dependencies
4872
FROM node:20-bookworm-slim
4973

74+
# Enable Corepack (for Yarn management) and install the required Yarn version
75+
RUN corepack enable
76+
77+
# Set Python interpreter for `node-gyp` to use
78+
ENV PYTHON=/usr/bin/python3
79+
5080
# Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend.
5181
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
5282
--mount=type=cache,target=/var/lib/apt,sharing=locked \
5383
apt-get update && \
5484
apt-get install -y --no-install-recommends python3 g++ build-essential && \
55-
yarn config set python /usr/bin/python3
85+
rm -rf /var/lib/apt/lists/*
86+
5687

5788
# From here on we use the least-privileged `node` user to run the backend.
5889
USER node
5990

91+
ENV DOCKER_BUILDKIT=1
92+
6093
# This should create the app dir as `node`.
6194
# If it is instead created as `root` then the `tar` command below will
6295
# fail: `can't create directory 'packages/': Permission denied`.
@@ -65,22 +98,36 @@ USER node
6598
WORKDIR /app
6699

67100
# Copy the install dependencies from the build stage and context
101+
COPY --from=build --chown=node:node /app/.yarn ./.yarn
102+
COPY --from=build --chown=node:node /app/.yarnrc.yml ./
103+
COPY --from=build --chown=node:node /app/backstage.json ./
68104
COPY --from=build --chown=node:node /app/yarn.lock /app/package.json /app/packages/backend/dist/skeleton/ ./
69105

106+
# Pre-create and fix ownership for cache directory
107+
RUN mkdir -p /home/node/.cache/node/corepack/v1 && \
108+
chown -R node:node /home/node/.cache
109+
70110
RUN --mount=type=cache,target=/home/node/.cache/yarn,sharing=locked,uid=1000,gid=1000 \
71-
yarn install --frozen-lockfile --production --network-timeout 600000
111+
yarn workspaces focus --all --production && rm -rf "$(yarn cache clean)"
72112

73113
# Copy the built packages from the build stage
74114
COPY --from=build --chown=node:node /app/packages/backend/dist/bundle/ ./
75115

76116
ARG APP_ENV
77117

118+
78119
# Copy any other files that we need at runtime, to understand how the configs work refer to the README.md
79-
COPY --chown=node:node app-config.yaml ./
80-
COPY --chown=node:node app-config.docker.yaml ./app-config.docker.yaml
81-
COPY --chown=node:node app-config.${APP_ENV}.yaml ./app-config.env.yaml
120+
COPY --chown=node:node app-config*.yaml ./
121+
# COPY --chown=node:node app-config.docker.yaml ./app-config.docker.yaml
122+
# COPY --chown=node:node app-config.${APP_ENV}.yaml ./app-config.env.yaml
123+
124+
# This will include the examples, if you don't need these simply remove this line
125+
COPY --chown=node:node examples ./examples
82126

83127
# This switches many Node.js dependencies to production mode. Important APP_ENV and NODE_ENV serve two different purposes
84128
ENV NODE_ENV production
85129

130+
# This disables node snapshot for Node 20 to work with the Scaffolder
131+
ENV NODE_OPTIONS="--no-node-snapshot"
132+
86133
CMD ["node", "packages/backend", "--config", "app-config.yaml", "--config", "app-config.docker.yaml", "--config", "app-config.env.yaml"]

app-config.docker.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,4 @@ app:
33

44
backend:
55
baseUrl: ${BASE_URL}
6-
listen: ':7007'
7-
8-
catalog:
9-
import:
10-
entityFilename: catalog-info.yaml
11-
pullRequestBranchName: backstage-integration
12-
rules:
13-
- allow: [Component, System, API, Resource, Location]
6+
listen: ':7007'

app-config.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ auth:
6363
development:
6464
clientId: ${GOOGLE_CLIENT_ID}
6565
clientSecret: ${GOOGLE_CLIENT_SECRET}
66-
signIn:
67-
resolvers:
68-
- resolver: emailLocalPartMatchingUserEntityName
69-
domain: code.berlin
66+
7067
github:
7168
development:
7269
clientId: ${GITHUB_CLIENT_ID}

catalog-info.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ spec:
2323
type: service
2424
owner: code_idp_team
2525
lifecycle: production
26-
2726
---
2827
apiVersion: backstage.io/v1alpha1
2928
kind: Group

docker-compose.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ services:
1212
POSTGRES_USER: ${POSTGRES_USER:-postgres}
1313
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-admin}
1414
GITHUB_TOKEN: ${GITHUB_TOKEN}
15+
GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
16+
GOOGLE_CLIENT_SECRET: ${GOOGLE_CLIENT_SECRET}
17+
GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID}
18+
GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET}
19+
GITLAB_TOKEN: ${GITLAB_TOKEN}
1520
BASE_URL: ${BASE_URL}
1621
ports:
1722
- 7007:7007

examples/template/content/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/template/content/package.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

examples/template/template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ spec:
7171
url: ${{ steps['publish'].output.remoteUrl }}
7272
- title: Open in catalog
7373
icon: catalog
74-
entityRef: ${{ steps['register'].output.entityRef }}
74+
entityRef: ${{ steps['register'].output.entityRef }}

packages/app/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"@backstage/plugin-techdocs-react": "^1.2.11",
4242
"@backstage/plugin-user-settings": "^0.8.16",
4343
"@backstage/theme": "^0.6.2",
44-
"@circleci/backstage-plugin": "^0.1.1",
4544
"@emotion/react": "^11.14.0",
4645
"@emotion/styled": "^11.14.0",
4746
"@material-ui/core": "^4.12.2",
@@ -63,7 +62,6 @@
6362
"@testing-library/react": "^14.0.0",
6463
"@testing-library/user-event": "^14.0.0",
6564
"@types/react-dom": "*",
66-
"cross-env": "^7.0.0",
6765
"jest-canvas-mock": "^2.5.2"
6866
},
6967
"browserslist": {

0 commit comments

Comments
 (0)