switch default docker-build command to build backend

This commit is contained in:
Patrik Oldsberg
2020-09-06 14:01:24 +02:00
parent b104ebce53
commit 10216391ba
5 changed files with 21 additions and 23 deletions
+6 -1
View File
@@ -1,9 +1,14 @@
FROM nginx:mainline
# The purpose of this image is to serve the frontend app content separately.
# By default the Backstage backend uses the app-backend plugin to serve the
# app from the backend itself, but it may be desirable to move the frontend
# content serving to a separate deployment, in which case this image can be used.
# This dockerfile requires the app to be built on the host first, as it
# simply copies in the build output into the image.
# The safest way to build this image is to use `yarn docker-build`
# The safest way to build this image is to use `yarn docker-build:app`
RUN apt-get update && apt-get -y install jq && rm -rf /var/lib/apt/lists/*
+2 -6
View File
@@ -1,14 +1,10 @@
# Make sure that before you
# run the docker-compose that you have run
# $ yarn docker-build:all
# $ yarn docker-build
version: '3'
services:
frontend:
image: 'spotify/backstage:latest'
ports:
- '3000:80'
backend:
backstage:
image: 'example-backend:latest'
ports:
- '7000:7000'
+6 -7
View File
@@ -10,21 +10,20 @@ title: Other
Run the following commands if you have Docker environment
```bash
$ yarn install
$ yarn docker-build
$ docker run --rm -it -p 80:80 spotify/backstage
$ docker run --rm -it -p 7000:7000 -e NODE_ENV=development example-backend:latest
```
Then open http://localhost/ on your browser.
### Running with `docker-compose`
Run the following commands if you have docker and docker-compose for a full
example, with the example backend also deployed.
There is also a `docker-compose.yaml` that you can use to replace the previous
`docker run` command:
```bash
$ yarn docker-build:all
$ yarn install
$ yarn docker-build
$ docker-compose up
```
Then open http://localhost:3000 on your browser to see the example app with an
example backend.
+5 -7
View File
@@ -171,21 +171,19 @@ The frontend container can be built with a provided command.
```bash
yarn install
yarn tsc
yarn build
yarn run docker-build
yarn run docker-build:app
```
Running this will simply generate a Docker container containing the contents of
the UIs `dist` directory. The resulting container will be about 50MB in size.
the UIs `dist` directory.
The backend container can be built by running the following command in the
`packages/backend` directory.
The backend container can be built by running the following command:
```bash
yarn run build-image
yarn run docker-build
```
This will create a ~500MB container called `example-backend`.
This will create a container called `example-backend`.
The lighthouse-audit-service container is already publicly available in Docker
Hub and can be downloaded and ran with
+2 -2
View File
@@ -18,8 +18,8 @@
"lint:all": "lerna run lint --",
"lint:type-deps": "node scripts/check-type-dependencies.js",
"docgen": "lerna run docgen",
"docker-build": "yarn workspace example-app build && docker build . -t spotify/backstage",
"docker-build:all": "yarn tsc && yarn build && yarn docker-build && yarn workspace example-backend build-image",
"docker-build:app": "yarn workspace example-app build && docker build . -t spotify/backstage",
"docker-build": "yarn tsc && yarn workspace example-backend build-image",
"create-plugin": "backstage-cli create-plugin",
"remove-plugin": "backstage-cli remove-plugin",
"release": "if [ \"$(git symbolic-ref --short HEAD)\" = master ]; then echo \"don't try to release master\"; exit 1; else lerna version --no-push --force-publish; fi",