CoolFace
Apppublic

edwagbb/GoTest

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
Dockerfile53 linesDownload Raw Back to root
1FROM  ghcr.io/aurora-develop/aurora:latest AS builder2FROM debian3WORKDIR /app4COPY --from=builder /app/aurora /app/aurora5COPY --from=builder /app/harPool /app/harPool6RUN apt-get update -y && apt-get install -y nodejs npm7RUN npm install express http-proxy-middleware8COPY anakin_proxy_linux_amd64 /app/anakin9COPY <<EOF /app/index.js10const express = require("express");11const app = express();12const { createProxyMiddleware } = require("http-proxy-middleware");13 14function authMiddleware(req, res, next) {15  res.setHeader('Access-Control-Allow-Origin','*');16  res.setHeader('Access-Control-Allow-Headers','*');17  if(req.method === "OPTIONS") return res.status(204).end();18  19  if (!process.env.authorization || (req.headers.authorization||req.url).indexOf(process.env.authorization)>-1) {20    next();21  } else {22    res.status(401).json({ error: 'Unauthorized' });23  }24}25 26app.use(authMiddleware);27 28app.use(29    "/aurora",30    createProxyMiddleware({31        target: "http://127.0.0.1:8080/",32        changeOrigin: true,33        pathRewrite: {34          '^/aurora': '',35        },36    })37);38 39app.use(40    "/anakin",41    createProxyMiddleware({42        target: "http://127.0.0.1:8000/",43        changeOrigin: true,44        pathRewrite: {45          '^/anakin': '',46        },47    })48);49app.listen(7860, () => console.log(`Example app listening on port ${port}!`));50EOF51RUN chmod -R u+rwx,g+rwx,o+rwx /app52 53CMD /app/aurora & /app/anakin & node /app/index.js