Javascript 如何使用electron将构建在Atom上的web应用程序对接?
我正在为一个项目构建一个web应用程序,我需要为我的应用程序创建一个映像,一个docker。在搜索了整个互联网并尝试了几件事情之后,我仍然无法为我的应用程序创建docker,因为为使用electron制作的应用程序提供的解决方案很少。 如果有人知道如何解决我的这个问题,我会非常感激,我已经有点失望了。 谢谢。 这是我的main.js文件:Javascript 如何使用electron将构建在Atom上的web应用程序对接?,javascript,html,css,json,Javascript,Html,Css,Json,我正在为一个项目构建一个web应用程序,我需要为我的应用程序创建一个映像,一个docker。在搜索了整个互联网并尝试了几件事情之后,我仍然无法为我的应用程序创建docker,因为为使用electron制作的应用程序提供的解决方案很少。 如果有人知道如何解决我的这个问题,我会非常感激,我已经有点失望了。 谢谢。 这是我的main.js文件: const electron = require("electron"); const app = electron.app; const
const electron = require("electron");
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const path = require("path");
const url = require("url");
let win;
function createWindow() {
win = new BrowserWindow({
width: 1920,
height:1080,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
// webviewTag:true,
}
});
win.loadURL(url.format({
pathname: path.join(__dirname, '../index.html'),
protocol: 'file',
slashes: true
}));
win.webContents.openDevTools();
win.on('closed', () => {
win = null;
})
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin')
app.quit();
})
这是我的docker文件:
FROM node:12
WORKDIR .
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 8080
CMD ["node","main.js"]
这是my package.json:
{
"name": "package",
"version": "1.0.0",
"description": "ADS project",
"homepage": "https://github.com/...",
"bugs": {
"url": "https://github.com/..."
},
"license": "ISC",
"main": "main.js",
"repository": {
"type": "git",
"url": "git+https://github.com/..."
},
"scripts": {
"start": "node main.js",
"test": "echo "Error: no test specified" && exit 1",
"eletron": "eletron .",
"electron-build": "ng build --prod && electron ."
},
"dependencies": {},
"devDependencies": {
"electron": "^9.3.4"
}
}