switch docker build to use backend:bundle

This commit is contained in:
Patrik Oldsberg
2021-02-16 23:48:03 +01:00
parent 49299a1faf
commit 92d7a8eedf
4 changed files with 22 additions and 10 deletions
+6 -3
View File
@@ -1,5 +1,8 @@
.git
docs
cypress
microsite
node_modules
packages/*/node_modules
plugins/*/node_modules
plugins/*/dist
packages
!packages/backend/dist
plugins
+1 -1
View File
@@ -20,7 +20,7 @@
"lint:all": "lerna run lint --",
"lint:type-deps": "node scripts/check-type-dependencies.js",
"docgen": "lerna run docgen",
"docker-build": "yarn tsc && yarn workspace example-backend build-image",
"docker-build": "yarn tsc && yarn workspace example-backend build --build-dependencies && yarn workspace example-backend build-image",
"create-plugin": "backstage-cli create-plugin --scope backstage --no-private",
"remove-plugin": "backstage-cli remove-plugin",
"release": "changeset version && yarn diff --yes && yarn prettier --write '{packages,plugins}/*/{package.json,CHANGELOG.md}' && yarn install --frozen-lockfile",
+13 -4
View File
@@ -1,16 +1,25 @@
FROM node:14-buster
# This dockerfile builds an image for the backend package.
# It should be executed with the root of the repo as docker context.
#
# Before building this image, be sure to have run the following commands in the repo root:
#
# yarn install
# yarn tsc
# yarn build
WORKDIR /usr/src/app
FROM node:14-buster-slim
WORKDIR /app
# Copy repo skeleton first, to avoid unnecessary docker cache invalidation.
# The skeleton contains the package.json of each package in the monorepo,
# and along with yarn.lock and the root package.json, that's enough to run yarn install.
ADD yarn.lock package.json skeleton.tar ./
ADD yarn.lock package.json packages/backend/dist/skeleton.tar.gz ./
RUN yarn install --frozen-lockfile --production --network-timeout 300000 && rm -rf "$(yarn cache dir)"
# This will copy the contents of the dist-workspace when running the build-image command.
# Do not use this Dockerfile outside of that command, as it will copy in the source code instead.
COPY . .
ADD packages/backend/dist/bundle.tar.gz app-config.yaml ./
CMD ["node", "packages/backend"]
+2 -2
View File
@@ -18,8 +18,8 @@
"backstage"
],
"scripts": {
"build": "backstage-cli backend:build",
"build-image": "backstage-cli backend:build-image --build --tag example-backend",
"build": "backstage-cli backend:bundle",
"build-image": "docker build ../.. -f Dockerfile --tag example-backend",
"start": "backstage-cli backend:dev",
"lint": "backstage-cli lint",
"test": "backstage-cli test",