diff --git a/contrib/docker/multi-stage-frontend/Dockerfile b/contrib/docker/multi-stage-frontend/Dockerfile new file mode 100644 index 0000000000..6c76c41715 --- /dev/null +++ b/contrib/docker/multi-stage-frontend/Dockerfile @@ -0,0 +1,28 @@ +FROM node:12 AS build + +# This dockerfile does not require the app to be built on the host machine. +# simply builds backstage in node image then transfers compiled files to nginx container. + +# You can build this image with `docker build -f Dockerfile.standalone -t backstage .` + +RUN mkdir /app +COPY . /app +WORKDIR /app + +RUN yarn install +RUN yarn workspace example-app build + +# Contruct backstage 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 diff --git a/contrib/docker/multi-stage-frontend/README.md b/contrib/docker/multi-stage-frontend/README.md new file mode 100644 index 0000000000..0ca0f039a3 --- /dev/null +++ b/contrib/docker/multi-stage-frontend/README.md @@ -0,0 +1,21 @@ +# 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 -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 +``` + +