Skip to content

Commit 78fcf32

Browse files
authored
Add a simple Procfile to serve static assets (#155)
* Sets a Procfile to use a Ruby HTTP server to serve up the app as a static site. * Adds a heroku-postbuild script in package.json which builds both the app and the web component. This takes precedence over build in the Heroku build process. This has a special env var of PUBLIC_URL set to an empty string so the webcomponent builds properly. * Adds a .dockerignore to make the docker build context smaller for faster local container rebuilds * Adds an app.json just to make the Heroku deployment a bit more in-keeping with other apps.
1 parent b75e496 commit 78fcf32

5 files changed

Lines changed: 23 additions & 1 deletion

File tree

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
build/
2+
dist/
3+
.git/
4+
node_modules/

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: ruby -run -e httpd -- -p $PORT build/

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,6 @@ Open [http://localhost:3001](http://localhost:3001) to view it in the browser.
5555

5656
There is no production build setup for the web component at present.
5757

58+
## Review apps
59+
60+
Currently the build is deployed to both S3 and Heroku. The PR should get updated with the Heroku URL, and the web component demo is at `/web-component.html` on the Heroku review app domain.

app.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "editor-ui",
3+
"formation": {
4+
"web": {
5+
"quantity": 1
6+
}
7+
},
8+
"buildpacks": [
9+
{
10+
"url": "heroku/nodejs"
11+
}
12+
]
13+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
"test": "node scripts/test.js --transformIgnorePatterns 'node_modules/(?!three)/'",
5858
"test:integration": "cd e2e; docker compose up --exit-code-from cypress",
5959
"start:wc": "NODE_ENV=development BABEL_ENV=development webpack serve -c ./webpack.component.config.js",
60-
"build:wc": "NODE_ENV=production BABEL_ENV=production webpack build -c ./webpack.component.config.js"
60+
"build:wc": "NODE_ENV=production BABEL_ENV=production webpack build -c ./webpack.component.config.js",
61+
"heroku-postbuild": "export PUBLIC_URL='' && yarn build && yarn build:wc"
6162
},
6263
"eslintConfig": {
6364
"extends": [

0 commit comments

Comments
 (0)