|
FROM debian |
|
WORKDIR /app |
|
RUN apt-get update -y && apt-get install -y nodejs npm |
|
RUN npm install express http-proxy-middleware |
|
|
|
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: true, |
|
pathRewrite: { |
|
'^/api': '', |
|
}, |
|
}) |
|
); |
|
|
|
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 |
|
|
|
CMD /app/anakin & node /app/index.js |