Skip to content

Commit

Permalink
Merge pull request #223 from bento-platform/fix/missing-script-prod
Browse files Browse the repository at this point in the history
fix: missing config prod js; chore: update dev base image
  • Loading branch information
davidlougheed authored Mar 22, 2023
2 parents 2f3c5d2 + 1617805 commit 6f27705
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 14 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ WORKDIR /web
COPY --from=build /web/dist ./dist
# Copy in package.json to provide version
COPY package.json .
# Copy in the production config generation script
COPY create_config_prod.js .
# Copy in the service info generator
COPY create_service_info.js .
# Copy in the entrypoint, which writes the config file and starts NGINX
Expand Down
13 changes: 11 additions & 2 deletions create_service_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,25 @@ const serviceInfo = {
},
};


const hasGit = (() => {
try {
return childProcess.execSync("which git").toString().trim() === "";
} catch (_e) {
// Exit code 1 (git not found)
return false;
}
})();
const git = cmd => childProcess.execSync(`git ${cmd}`).toString().trim();
if (nodeEnv === "development") {
if (nodeEnv === "development" && hasGit) {
try {
serviceInfo.bento.gitTag = git("describe --tags --abbrev=0");
serviceInfo.bento.gitBranch = git("branch --show-current");
serviceInfo.bento.gitCommit = git("rev-parse HEAD");
} catch (e) {
console.warn(`Could not get git information (${e})`);
}
} else if (!hasGit) {
console.warn("Could not get git information (missing git)");
}

if (typeof require !== "undefined" && require.main === module) {
Expand Down
4 changes: 3 additions & 1 deletion dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ COPY package-lock.json .

RUN npm ci

FROM ghcr.io/bento-platform/bento_base_image:node-debian-2023.03.06
FROM ghcr.io/bento-platform/bento_base_image:node-debian-2023.03.22

LABEL org.opencontainers.image.description="Local development image for Bento Web."

WORKDIR /web

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bento_web",
"version": "1.8.0",
"version": "1.8.1",
"description": "Bento platform front-end",
"main": "src/index.js",
"dependencies": {
Expand Down
12 changes: 4 additions & 8 deletions run.dev.bash
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#!/bin/bash

echo "[bento_web] [entrypoint] setting .gitconfig"
# Base image handles making bento_user and setting its .gitconfig

# Set .gitconfig for development
/set_gitconfig.bash

if [[ -z "${BENTO_WEB_PORT}" ]]; then
# Set default internal port to 80
export BENTO_WEB_PORT=80
fi
# Set default internal port to 80
: "${BENTO_WEB_PORT:=80}"
export BENTO_WEB_PORT

# ----- Begin /service-info creation ----------------------------------
echo "[bento_web] [entrypoint] creating service-info file"
Expand Down

0 comments on commit 6f27705

Please sign in to comment.