Skip to content

Commit

Permalink
Bundle pre-built storefront rather than build from source
Browse files Browse the repository at this point in the history
Building from source is too memory-intensive and fails when attempting it on the 1GB RAM digital ocean droplet the demo currently resides on.
  • Loading branch information
michaelbromley committed May 23, 2019
1 parent 2ef1bd9 commit ef3be4b
Show file tree
Hide file tree
Showing 36 changed files with 237,379 additions and 6 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules
data-cache
vendure/assets
demo-storefront/storefront
yarn-error.log
Dockerfile
.dockerignore
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ vendure/email/output
vendure.sqlite
yarn-error.log
data-cache
demo-storefront/storefront
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,5 @@ COPY yarn.lock ./
USER node
RUN yarn
COPY --chown=node:node . .
RUN ["chmod", "+x", "demo-storefront/install-storefront.sh"]
RUN demo-storefront/install-storefront.sh
EXPOSE 3000
CMD [ "pm2-runtime", "index.js" ]
4 changes: 2 additions & 2 deletions demo-storefront/demo-storefront-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const os = require('os');
*/
class DemoStorefrontPlugin {
onBootstrap() {
this.serverProcess = spawn(`node`, ['storefront/dist/server.js'], { cwd: __dirname });
this.serverProcess = spawn(`node`, ['storefront/server.js'], { cwd: __dirname });
this.serverProcess.stdout.on('data', (data) => {
console.log(`Storefront server: ${data}`);
});
Expand Down Expand Up @@ -46,7 +46,7 @@ class DemoStorefrontPlugin {
* the server admin API.
*/
async overwriteAdminUiConfig(host, port) {
const configPath = path.join(__dirname, 'storefront/dist/browser/storefront-config.json');
const configPath = path.join(__dirname, 'storefront/browser/storefront-config.json');
const storefrontConfig = await fs.readFile(configPath, 'utf-8');
const config = JSON.parse(storefrontConfig);
config.apiHost = host;
Expand Down
2 changes: 2 additions & 0 deletions demo-storefront/install-storefront.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env bash
# Not currently used because building the storefront takes up
# too much memory for the basic DigitalOcean droplet it is hosted on.
cd "${0%/*}"
git clone https://github.com/vendure-ecommerce/storefront.git
cd storefront
Expand Down
Loading

0 comments on commit ef3be4b

Please sign in to comment.