GoTest / Dockerfile
edwagbb's picture
Update Dockerfile
b78f757 verified
raw
history blame
848 Bytes
FROM debian
RUN mkdir -p /app
RUN apt-get update -y && apt-get install -y nodejs npm
RUN npm install express nodejs
COPY <<EOF /app/index.js
const express = require("express");
const app = express();
const { createProxyMiddleware } = require("http-proxy-middleware");
app.use(
"/" + "*",
createProxyMiddleware({
target: "http://127.0.0.1:8000/", // 需要跨域处理的请求地址
changeOrigin: false, // 默认false,是否需要改变原始主机头为目标URL
ws: true,
logLevel: "error",
onProxyReq: function onProxyReq(proxyReq, req, res) { }
})
);
app.listen(7860, () => console.log(`Example app listening on port ${port}!`));
EOF
COPY anakin_proxy_linux_amd64 /app/anakin
RUN chmod -R u+rwx,g+rwx,o+rwx /app && chmod +x /app/anakin
WORKDIR /app
CMD /app/anakin & node /app/index.js