Skip to content

Instantly share code, notes, and snippets.

@eikeland
Last active June 1, 2023 06:59
Show Gist options
  • Save eikeland/d6d81768d15dd543e16b82dc4b9bb593 to your computer and use it in GitHub Desktop.
Save eikeland/d6d81768d15dd543e16b82dc4b9bb593 to your computer and use it in GitHub Desktop.
Build Portal ready app bundle with the new fusion-framework-cli

Docker buildx

Run Docker buildx to compile app bundle.

docker buildx build -f build.Dockerfile --build-arg APP_KEY={APP_KEY} -o type=local,dest=dist --target=export . 

Then upload app bundle {APP_KEY}.zip to Fusion Portal with fdev.

FROM node:16-alpine as manifest
WORKDIR /build
COPY package.json ./
COPY create-manifest.js ./
RUN node create-manifest.js > 'app-manifest.json'
FROM node:16-alpine as base
WORKDIR /build
COPY package*.json ./
COPY app-icon.png ./
COPY app-icon.svg ./
COPY app.config.js ./
COPY src ./src
RUN npm ci
RUN npm run build
FROM node:16-alpine as bundle
ARG APP_KEY
WORKDIR /bundle
RUN apk --no-cache add zip
COPY --from=manifest /build/app-manifest.json ./
COPY --from=base /build/app-icon.svg ./
COPY --from=base /build/dist/app-bundle.js ./
RUN zip ${APP_KEY}.zip app-manifest.json app-bundle.js app-icon.svg
FROM scratch as export
COPY --from=bundle /bundle .
import * as path from 'path';
import { createRequire } from "module";
const require = createRequire(import.meta.url);
const pkg = require("./package.json");
const parseVersion = (version) => {
const parts = version.split('.');
return {
major: parts[0],
minor: parts[1],
patch: parts[2],
};
}
const key = [pkg.name].filter(x => !!x).join('-');
const manifest = {
key,
name: key,
shortName: key,
description: pkg.description,
main: pkg.main,
version: parseVersion(pkg.version),
icon: ''
}
console.log(JSON.stringify(manifest, null, 2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment