Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimirvshivkov committed Sep 9, 2024
1 parent b5aa924 commit aeb247a
Show file tree
Hide file tree
Showing 3 changed files with 694 additions and 1,987 deletions.
17 changes: 5 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# syntax=docker/dockerfile:1.2

# Stage 1 - Create yarn install skeleton layer
FROM node:18-bookworm-slim AS packages
FROM node:20-bookworm-slim AS packages

WORKDIR /app
COPY package.json yarn.lock ./
Expand All @@ -14,14 +14,14 @@ COPY plugins plugins
RUN find packages \! -name "package.json" -mindepth 2 -maxdepth 2 -exec rm -rf {} \+

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

# Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend.
RUN apt-get update && \
apt-get install -y --no-install-recommends python3 g++ build-essential && \
apt-get install -y --no-install-recommends python3 g++ git build-essential && \
yarn config set python /usr/bin/python3

# Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image,
# Install sqlite3 dependencies. You can skip this if yo=u don't use sqlite3 in the image,
# in which case you should also move better-sqlite3 to "devDependencies" in package.json.
RUN apt-get update && \
apt-get install -y --no-install-recommends libsqlite3-dev
Expand All @@ -40,15 +40,13 @@ COPY --chown=node:node . .

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

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

# Stage 3 - Build the actual backend image and install production dependencies
FROM node:18-bookworm-slim
FROM node:20-bookworm-slim

# Install isolate-vm dependencies, these are needed by the @backstage/plugin-scaffolder-backend.
RUN apt-get update && \
Expand All @@ -63,11 +61,6 @@ RUN apt-get update && \
# From here on we use the least-privileged `node` user to run the backend.
USER node

# This should create the app dir as `node`.
# If it is instead created as `root` then the `tar` command below will
# fail: `can't create directory 'packages/': Permission denied`.
# If this occurs, then ensure BuildKit is enabled (`DOCKER_BUILDKIT=1`)
# so the app dir is correctly created as `node`.
WORKDIR /app

# Copy the install dependencies from the build stage and context
Expand Down
24 changes: 17 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@
"test:all": "backstage-cli repo test --coverage",
"test:e2e": "playwright test",
"fix": "backstage-cli repo fix",
"lint": "backstage-cli repo lint --since origin/main",
"lint": "backstage-cli repo lint --since origin/master",
"lint:all": "backstage-cli repo lint",
"prettier:check": "prettier --check .",
"new": "backstage-cli new --scope internal"
"new": "backstage-cli new --scope internal",
"knip": "knip",
"prepare": "husky",
"postinstall": "husky || true"
},
"workspaces": {
"packages": [
Expand All @@ -31,14 +34,21 @@
]
},
"devDependencies": {
"@backstage/cli": "^0.27.0",
"@backstage/cli": "^0.27.1-next.1",
"@backstage/e2e-test-utils": "^0.1.1",
"@playwright/test": "^1.32.3",
"@spotify/prettier-config": "^12.0.0",
"@spotify/prettier-config": "^15.0.0",
"@types/lodash": "^4.14.202",
"@types/node": "^20.10.5",
"concurrently": "^8.0.0",
"lerna": "^7.3.0",
"node-gyp": "^10.0.0",
"prettier": "^2.3.2",
"eslint": "^8.6.0",
"fs-extra": "11.2.0",
"husky": "^9.0.0",
"jest": "^29.7.0",
"knip": "^5.0.0",
"lint-staged": "^15.0.0",
"node-fetch": "^2.6.7",
"prettier": "^3.0.0",
"typescript": "~5.4.0"
},
"resolutions": {
Expand Down
Loading

0 comments on commit aeb247a

Please sign in to comment.