Updated dockerfile and docker docs

Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com>
This commit is contained in:
Andre Wanlin
2023-07-08 18:12:17 -05:00
parent c4a9eb45ab
commit 4f7292c74d
3 changed files with 18 additions and 10 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/create-app': patch
---
Updated included Dockerfile to include `g++`. Also updated the comments to note that some of the dependecies are also needed by isolated-vm
+10 -8
View File
@@ -37,7 +37,7 @@ The required steps in the host build are to install dependencies with
`yarn install`, generate type definitions using `yarn tsc`, and build the backend
package with `yarn build:backend`.
In a CI workflow it might look something like this:
In a CI workflow it might look something like this, from the root:
```bash
yarn install --frozen-lockfile
@@ -47,7 +47,7 @@ yarn tsc
# Build the backend, which bundles it all up into the packages/backend/dist folder.
# The configuration files here should match the one you use inside the Dockerfile below.
yarn build:backend --config app-config.yaml
yarn build:backend --config ../../app-config.yaml
```
Once the host build is complete, we are ready to build our image. The following
@@ -56,12 +56,13 @@ Once the host build is complete, we are ready to build our image. The following
```Dockerfile
FROM node:16-bullseye-slim
# Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image,
# Install sqlite3 and isolated-vm dependencies.
# You can remove libsqlite3-dev if you don't use sqlite3 in the image,
# in which case you should also move better-sqlite3 to "devDependencies" in package.json.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get install -y --no-install-recommends libsqlite3-dev python3 build-essential && \
apt-get install -y --no-install-recommends libsqlite3-dev python3 g++ build-essential && \
yarn config set python /usr/bin/python3
# From here on we use the least-privileged `node` user to run the backend.
@@ -169,11 +170,11 @@ RUN find packages \! -name "package.json" -mindepth 2 -maxdepth 2 -exec rm -rf {
# Stage 2 - Install dependencies and build packages
FROM node:16-bullseye-slim AS build
# install sqlite3 dependencies
# Install sqlite3 and isolated-vm dependencies, if you don't use sqlite you can remove libsqlite3-dev
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get install -y --no-install-recommends libsqlite3-dev python3 build-essential && \
apt-get install -y --no-install-recommends libsqlite3-dev python3 g++ build-essential && \
yarn config set python /usr/bin/python3
USER node
@@ -200,12 +201,13 @@ RUN mkdir packages/backend/dist/skeleton packages/backend/dist/bundle \
# Stage 3 - Build the actual backend image and install production dependencies
FROM node:16-bullseye-slim
# Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image,
# Install sqlite3 and isolated-vm dependencies.
# You can remove libsqlite3-dev if you don't use sqlite3 in the image,
# in which case you should also move better-sqlite3 to "devDependencies" in package.json.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get install -y --no-install-recommends libsqlite3-dev python3 build-essential && \
apt-get install -y --no-install-recommends libsqlite3-dev python3 g++ build-essential && \
yarn config set python /usr/bin/python3
# From here on we use the least-privileged `node` user to run the backend.
@@ -11,12 +11,13 @@
FROM node:16-bullseye-slim
# Install sqlite3 dependencies. You can skip this if you don't use sqlite3 in the image,
# Install sqlite3 and isolated-vm dependencies.
# You can remove libsqlite3-dev if you don't use sqlite3 in the image,
# in which case you should also move better-sqlite3 to "devDependencies" in package.json.
RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
apt-get update && \
apt-get install -y --no-install-recommends libsqlite3-dev python3 build-essential && \
apt-get install -y --no-install-recommends libsqlite3-dev python3 g++ build-essential && \
yarn config set python /usr/bin/python3
# From here on we use the least-privileged `node` user to run the backend.