nirkyy commited on
Commit
f3f2aa9
·
verified ·
1 Parent(s): 1318bf3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +5 -4
Dockerfile CHANGED
@@ -1,8 +1,9 @@
 
1
  FROM node:20-slim
2
 
3
  WORKDIR /app
4
 
5
- RUN cat << EOF > package.json
6
  {
7
  "name": "gemini-proxy-server",
8
  "version": "1.0.0",
@@ -20,7 +21,7 @@ EOF
20
 
21
  RUN npm install --only=production
22
 
23
- RUN cat << EOF > index.js
24
  const express = require('express');
25
  const cors = require('cors');
26
  const axios = require('axios');
@@ -55,7 +56,7 @@ app.post('/api/generate', async (req, res) => {
55
 
56
  try {
57
  const apiKey = getRandomApiKey();
58
- const apiUrl = `\${API_URL_BASE}/\${MODEL_ID}:streamGenerateContent?key=\${apiKey}`;
59
 
60
  const requestBody = {
61
  contents: [{
@@ -86,7 +87,7 @@ app.post('/api/generate', async (req, res) => {
86
  });
87
 
88
  app.listen(PORT, () => {
89
- console.log(`Server berjalan di http://localhost:\${PORT}`);
90
  });
91
  EOF
92
 
 
1
+ # syntax=docker/dockerfile:1
2
  FROM node:20-slim
3
 
4
  WORKDIR /app
5
 
6
+ COPY <<EOF /app/package.json
7
  {
8
  "name": "gemini-proxy-server",
9
  "version": "1.0.0",
 
21
 
22
  RUN npm install --only=production
23
 
24
+ COPY <<EOF /app/index.js
25
  const express = require('express');
26
  const cors = require('cors');
27
  const axios = require('axios');
 
56
 
57
  try {
58
  const apiKey = getRandomApiKey();
59
+ const apiUrl = `${API_URL_BASE}/${MODEL_ID}:streamGenerateContent?key=${apiKey}`;
60
 
61
  const requestBody = {
62
  contents: [{
 
87
  });
88
 
89
  app.listen(PORT, () => {
90
+ console.log(`Server berjalan di http://localhost:${PORT}`);
91
  });
92
  EOF
93