Merge pull request #5391 from backstage/freben/standalone-frontend
update the standalone frontend contribs
This commit is contained in:
@@ -17,6 +17,7 @@ Datadog
|
||||
Debounce
|
||||
Discoverability
|
||||
Dockerfile
|
||||
dockerfiles
|
||||
Dockerize
|
||||
Docusaurus
|
||||
Env
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
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.
|
||||
|
||||
RUN apt-get update && apt-get -y install jq && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY packages/app/dist /usr/share/nginx/html
|
||||
COPY docker/default.conf.template /etc/nginx/conf.d/default.conf.template
|
||||
COPY docker/run.sh /usr/local/bin/run.sh
|
||||
CMD run.sh
|
||||
|
||||
ENV PORT 80
|
||||
@@ -0,0 +1,59 @@
|
||||
# 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 also performs the build first inside docker. This may come
|
||||
# with a build time impact, but is sometimes desirable. If you want to run the
|
||||
# build on the host instead, use the file simply named Dockerfile in this folder
|
||||
# instead.
|
||||
|
||||
# USAGE:
|
||||
#
|
||||
# - Copy this file and the "docker" folder from this directory to your project
|
||||
# root
|
||||
#
|
||||
# - Update your .dockerignore, make sure that the source folders are not
|
||||
# excluded, but do exclude node_modules and build artifacts:
|
||||
#
|
||||
# .git
|
||||
# node_modules
|
||||
# packages/*/dist
|
||||
# packages/*/node_modules
|
||||
# plugins/*/dist
|
||||
# plugins/*/node_modules
|
||||
#
|
||||
# - Update the copy of this file to add configuration arguments to the "build"
|
||||
# command, for example:
|
||||
#
|
||||
# RUN yarn workspace app build --config <config1> --config <config2> ...
|
||||
#
|
||||
# - In your project root, run:
|
||||
#
|
||||
# docker build -t backstage-frontend -f Dockerfile.dockerbuild .
|
||||
|
||||
|
||||
|
||||
FROM node:14-buster AS build
|
||||
|
||||
RUN mkdir /app
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
|
||||
RUN yarn install
|
||||
RUN yarn workspace app build
|
||||
|
||||
|
||||
|
||||
FROM nginx:mainline
|
||||
|
||||
RUN apt-get update && apt-get -y install jq && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=build /app/packages/app/dist /usr/share/nginx/html
|
||||
COPY docker/default.conf.template /etc/nginx/conf.d/default.conf.template
|
||||
COPY docker/run.sh /usr/local/bin/run.sh
|
||||
|
||||
CMD run.sh
|
||||
|
||||
ENV PORT 80
|
||||
@@ -0,0 +1,41 @@
|
||||
# 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. If you want to also perform
|
||||
# the build itself inside docker, use Dockerfile.build in this folder instead.
|
||||
|
||||
|
||||
# USAGE:
|
||||
#
|
||||
# - Copy this file and the "docker" folder from this directory to your project
|
||||
# root
|
||||
#
|
||||
# - Add the following line to your .dockerignore to make sure that the built
|
||||
# frontend actually can be transferred into the docker image:
|
||||
#
|
||||
# !packages/app/dist
|
||||
#
|
||||
# - In your project root, run:
|
||||
#
|
||||
# yarn install
|
||||
# yarn tsc
|
||||
# yarn build --config <config1> --config <config2> ...
|
||||
# docker build -t backstage-frontend -f Dockerfile.hostbuild .
|
||||
|
||||
|
||||
|
||||
FROM nginx:mainline
|
||||
|
||||
RUN apt-get update && apt-get -y install jq && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY packages/app/dist /usr/share/nginx/html
|
||||
COPY docker/default.conf.template /etc/nginx/conf.d/default.conf.template
|
||||
COPY docker/run.sh /usr/local/bin/run.sh
|
||||
|
||||
CMD run.sh
|
||||
|
||||
ENV PORT 80
|
||||
@@ -0,0 +1,16 @@
|
||||
# Frontend with NGINX
|
||||
|
||||
This folder contains Docker images that let you run the Backstage frontend as
|
||||
a separate image, rather than having it served through the `app-backend` plugin
|
||||
from the backend.
|
||||
|
||||
Note that when running the frontend like this, the app configuration becomes
|
||||
embedded into the actual static JavaScript files at build time. This means that
|
||||
you will have to supply the list of configuration files as part of the command
|
||||
line at build.
|
||||
|
||||
## Usage
|
||||
|
||||
There are two variants: one that builds inside Docker, and one that builds on
|
||||
the host. See the comments at the top of the individual dockerfiles for usage
|
||||
instructions.
|
||||
@@ -1,23 +0,0 @@
|
||||
FROM node:12-buster AS build
|
||||
|
||||
RUN mkdir /app
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
|
||||
RUN yarn install
|
||||
RUN yarn workspace example-app build
|
||||
|
||||
# Contruct backstage-frontend image
|
||||
FROM nginx:mainline
|
||||
|
||||
RUN apt-get update && apt-get -y install jq && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Copy from build stage
|
||||
COPY --from=build /app/packages/app/dist /usr/share/nginx/html
|
||||
|
||||
COPY docker/default.conf.template /etc/nginx/conf.d/default.conf.template
|
||||
COPY docker/run.sh /usr/local/bin/run.sh
|
||||
|
||||
CMD run.sh
|
||||
|
||||
ENV PORT 80
|
||||
@@ -1,19 +0,0 @@
|
||||
# Standalone Dockerfile for frontend
|
||||
|
||||
This directory contains the resources which will help you build backstage without any requirements
|
||||
other than docker itself. It uses a multi-stage Dockerfile to build and ship backstage.
|
||||
|
||||
## Usage
|
||||
|
||||
You can simply run the following command to build backstage.
|
||||
|
||||
```
|
||||
# Make sure you are in the root directory of backstage then run
|
||||
docker build -t backstage-frontend -f ./contrib/docker/multi-stage-frontend/Dockerfile .
|
||||
```
|
||||
|
||||
After a successful build, You can simply run backstage frontend with the following command.
|
||||
|
||||
```
|
||||
docker run -it --rm -p 3080:80 backstage-frontend
|
||||
```
|
||||
@@ -232,7 +232,7 @@ package, which is done as follows:
|
||||
Once the `app-backend` is removed from the backend, you can use your favorite
|
||||
static file serving method for serving the frontend. An example of how to set up
|
||||
an NGINX image is available in the
|
||||
[contrib folder in the main repo](https://github.com/backstage/backstage/blob/master/contrib/docker/frontend-with-nginx/Dockerfile)
|
||||
[contrib folder in the main repo](https://github.com/backstage/backstage/blob/master/contrib/docker/frontend-with-nginx)
|
||||
|
||||
Note that if you're building a separate docker build of the frontend you
|
||||
probably need to adjust `.dockerignore` appropriately. Most likely by making
|
||||
|
||||
Reference in New Issue
Block a user