diff --git a/Dockerfile b/Dockerfile index 6aea3ed9..34027e8d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,7 @@ COPY . ./ RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn \ yarn install --immutable && \ yarn run build && \ - yarn run webpack:prod bundle + STANDALONE=1 yarn run webpack:prod bundle # --------------------------------------------------------------------------------- # for production @@ -27,9 +27,11 @@ COPY --from=build /usr/src/app/dist /usr/src/conda-store-ui/dist RUN cd app && npm install +ENV NODE_ENV=production + EXPOSE 8000 -CMD ["NODE_ENV=production", "node", "app/serve.js"] +CMD ["node", "app/serve.js"] # --------------------------------------------------------------------------------- # for dev diff --git a/src/index.html b/src/index.html index 3f11672e..bc41f694 100644 --- a/src/index.html +++ b/src/index.html @@ -3,7 +3,9 @@ <%= htmlWebpackPlugin.options.title %> - + <% if (needsRuntimeConfig) { %> + + <% } %> diff --git a/webpack.config.js b/webpack.config.js index 63c8c7a3..4741c92a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -16,6 +16,7 @@ const packageJson = require('./package.json'); const isProd = process.env.NODE_ENV === "production"; const ASSET_PATH = isProd ? "" : "/"; +const needsRuntimeConfig = process.env.STANDALONE || false ; const version = packageJson.version; // Calculate hash based on content, will be used when generating production @@ -94,6 +95,9 @@ module.exports = { new HtmlWebpackPlugin({ title: "conda-store", template: "src/index.html", + templateParameters: { + needsRuntimeConfig: needsRuntimeConfig + } }), new HtmlWebpackPlugin({ filename: "memory-router-test.html",