add docker
This commit is contained in:
24
apps/node/.dockerignore
Normal file
24
apps/node/.dockerignore
Normal file
@ -0,0 +1,24 @@
|
||||
**/.classpath
|
||||
**/.dockerignore
|
||||
**/.env
|
||||
**/.git
|
||||
**/.gitignore
|
||||
**/.project
|
||||
**/.settings
|
||||
**/.toolstarget
|
||||
**/.vs
|
||||
**/.vscode
|
||||
**/*.*proj.user
|
||||
**/*.dbmdl
|
||||
**/*.jfm
|
||||
**/charts
|
||||
**/docker-compose*
|
||||
**/compose*
|
||||
**/Dockerfile*
|
||||
**/node_modules
|
||||
**/npm-debug.log
|
||||
**/obj
|
||||
**/secrets.dev.yaml
|
||||
**/values.dev.yaml
|
||||
LICENSE
|
||||
README.md
|
@ -1,4 +1,4 @@
|
||||
NODE_ID=1
|
||||
|
||||
API_PORT=3000
|
||||
API_PORT=3001
|
||||
INFISICAL_TOKEN=YOUR_TOKEN
|
10
apps/node/Dockerfile
Normal file
10
apps/node/Dockerfile
Normal file
@ -0,0 +1,10 @@
|
||||
FROM fascinated/docker-images:node-pnpm-latest
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
COPY package.json pnpm-lock.yaml ./
|
||||
RUN pnpm install
|
||||
COPY . .
|
||||
RUN pnpm run build
|
||||
ENV PORT=3000
|
||||
EXPOSE 3000
|
||||
CMD [ "pnpm", "start" ]
|
@ -9,6 +9,7 @@ export default class ProxyRoute extends Route {
|
||||
}
|
||||
|
||||
async handle(req: Request, res: Response) {
|
||||
const before = Date.now();
|
||||
const json = req.body;
|
||||
const secret = json.secret;
|
||||
if (!secret) {
|
||||
@ -49,6 +50,13 @@ export default class ProxyRoute extends Route {
|
||||
delete headers["cf-ray"];
|
||||
delete headers["alt-svc"];
|
||||
|
||||
// Misc headers
|
||||
delete headers["transfer-encoding"];
|
||||
|
||||
// Add node specific headers
|
||||
headers["x-proxy-node"] = process.env.NODE_ID;
|
||||
headers["x-proxy-response-time"] = Date.now() - before + "ms";
|
||||
|
||||
// Return the JSON response
|
||||
res.status(response.status).set(headers).json(data);
|
||||
}
|
||||
|
Reference in New Issue
Block a user