fix(servers): Use a empty app config instead of starter config for lowdefy default.

This commit is contained in:
SamTolmay 2021-06-08 15:30:57 +02:00
parent b0abb39e10
commit db4b7f9028
7 changed files with 60 additions and 9 deletions

View File

@ -10,8 +10,8 @@ COPY . .
RUN yarn install
RUN yarn build
# Build lowdefy starter app
RUN yarn build:lowdefy-starter
# Build lowdefy default app
RUN yarn build:lowdefy-default
# clean all depencies
RUN rm -rf node_modules
@ -27,12 +27,15 @@ ENV NODE_ENV=production
WORKDIR /var/task
# Copy build artifacts
COPY --from=build /lowdefy/node_modules /var/task/node_modules
COPY --from=build /lowdefy/dist /var/task/dist
COPY --from=build /lowdefy/.lowdefy/build ./build
# Copy default public files from shell
# These can be overridden by copying different files to ./public
RUN cp -R ./node_modules/@lowdefy/shell/dist/public ./public
CMD [ "dist/server.handler"]

View File

@ -0,0 +1,22 @@
/*
Copyright 2020-2021 Lowdefy, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
const fs = require('fs');
const pkgJson = require('./package.json');
const { version } = pkgJson;
fs.writeFileSync('./lowdefy.yaml', `lowdefy: ${version}`);

View File

@ -33,8 +33,8 @@
"babel": "babel src --out-dir dist",
"build": "yarn babel",
"build:docker": "docker build --tag lowdefy/lowdefy .",
"build:lowdefy-starter": "lowdefy init && lowdefy build",
"clean": "rm -rf dist && rm -rf dev",
"build:lowdefy-default": "node lowdefyDefault.cjs && lowdefy build",
"clean": "rm -rf dist && rm -rf .lowdefy",
"prepare": "yarn build",
"start": "nodemon dist/server.js"
},

View File

@ -10,8 +10,8 @@ COPY . .
RUN yarn install
RUN yarn build
# Build lowdefy starter app
RUN yarn build:lowdefy-starter
# Build lowdefy default app
RUN yarn build:lowdefy-default
# clean all depencies
RUN rm -rf node_modules
@ -25,18 +25,22 @@ FROM node:14-alpine
ENV NODE_ENV=production
# Set up working directory and use non-root "node" user
RUN mkdir -p /home/node/lowdefy && chown -R node:node /home/node/lowdefy
WORKDIR /home/node/lowdefy
USER node
# Copy build artifacts
COPY --from=build --chown=node:node /lowdefy/node_modules ./node_modules
COPY --from=build --chown=node:node /lowdefy/dist ./dist
COPY --from=build --chown=node:node /lowdefy/.lowdefy/build ./build
# Copy default public files from shell
# These can be overridden by copying different files to ./public
RUN cp -R ./node_modules/@lowdefy/shell/dist/public ./public
CMD ["node", "/home/node/lowdefy/dist/server.js"]

View File

@ -0,0 +1,22 @@
/*
Copyright 2020-2021 Lowdefy, Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
const fs = require('fs');
const pkgJson = require('./package.json');
const { version } = pkgJson;
fs.writeFileSync('./lowdefy.yaml', `lowdefy: ${version}`);

View File

@ -33,8 +33,8 @@
"babel": "babel src --out-dir dist",
"build": "yarn babel",
"build:docker": "docker build --tag lowdefy/lowdefy .",
"build:lowdefy-starter": "lowdefy init && lowdefy build",
"clean": "rm -rf dist && rm -rf dev",
"build:lowdefy-default": "node lowdefyDefault.cjs && lowdefy build",
"clean": "rm -rf dist && rm -rf .lowdefy",
"prepare": "yarn build",
"start": "nodemon dist/server.js"
},

View File

@ -32,7 +32,7 @@
"scripts": {
"babel": "babel src/functions --out-dir dist/functions",
"build": "yarn webpack && yarn babel",
"clean": "rm -rf dist && rm -rf dev",
"clean": "rm -rf dist && rm -rf .lowdefy",
"prepare": "yarn build",
"webpack": "webpack --config webpack.config.js"
},