Unsterile commited on
Commit
2768617
1 Parent(s): 9b0aebb

one-api during building

Browse files
Files changed (3) hide show
  1. Dockerfile +1 -1
  2. on_startup.sh +17 -0
  3. start_server.sh +6 -2
Dockerfile CHANGED
@@ -63,7 +63,7 @@ RUN curl -s https://api.github.com/repos/gitpod-io/openvscode-server/releases/la
63
  && rm -rf /var/tmp/*
64
 
65
  # Install Node.js and configurable-http-proxy
66
- RUN curl -sL https://deb.nodesource.com/setup_16.x | bash - \
67
  && apt-get install -y nodejs \
68
  && npm install -g configurable-http-proxy \
69
  && rm -rf /var/lib/apt/lists/* \
 
63
  && rm -rf /var/tmp/*
64
 
65
  # Install Node.js and configurable-http-proxy
66
+ RUN curl -sL https://deb.nodesource.com/setup_18.x | bash - \
67
  && apt-get install -y nodejs \
68
  && npm install -g configurable-http-proxy \
69
  && rm -rf /var/lib/apt/lists/* \
on_startup.sh CHANGED
@@ -5,3 +5,20 @@
5
  # cd transformers && pip install -e ".[dev]"
6
  # useradd -m aku && adduser aku sudo && echo 'aku:aku' | sudo chpasswd && sed -i 's/\/bin\/sh/\/bin\/bash/g' /etc/passwd
7
  # /usr/bin/newuidmap 1500 0 1000 1 1 100000 65536
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  # cd transformers && pip install -e ".[dev]"
6
  # useradd -m aku && adduser aku sudo && echo 'aku:aku' | sudo chpasswd && sed -i 's/\/bin\/sh/\/bin\/bash/g' /etc/passwd
7
  # /usr/bin/newuidmap 1500 0 1000 1 1 100000 65536
8
+ git clone https://github.com/ckt1031/one-api/
9
+
10
+ # Build the frontend
11
+ cd one-api/web
12
+ npm install
13
+ npm run build
14
+
15
+ # Build the backend
16
+ cd ..
17
+ export GO111MODULE=on
18
+ export CGO_ENABLED=1
19
+ export GOOS=linux
20
+ python ./i18n/translate.py --repository_path . --json_file_path ./i18n/en.json
21
+ go mod download
22
+ go build -ldflags "-s -w -X 'one-api/common.Version=$(cat VERSION)' -extldflags '-static'" -o one-api
23
+ chmod u+x one-api
24
+ #./one-api --port 3000 --log-dir ./logs
start_server.sh CHANGED
@@ -1,10 +1,14 @@
1
  #!/bin/bash
2
 
 
 
3
  echo "Starting VSCode Server..."
4
  /app/openvscode-server/bin/openvscode-server --host 0.0.0.0 --port 7860 --without-connection-token "${@}" &
5
 
6
- echo "Starting Code Tunnel..."
7
- /usr/bin/code tunnel --accept-server-license-terms &
 
 
8
 
9
  # Sleep for a long time to keep the container running
10
  sleep infinity
 
1
  #!/bin/bash
2
 
3
+ service nginx start
4
+
5
  echo "Starting VSCode Server..."
6
  /app/openvscode-server/bin/openvscode-server --host 0.0.0.0 --port 7860 --without-connection-token "${@}" &
7
 
8
+ /home/user/one-api/one-api --port 3000 --log-dir ./logs &
9
+
10
+ #echo "Starting Code Tunnel..."
11
+ #/usr/bin/code tunnel --accept-server-license-terms &
12
 
13
  # Sleep for a long time to keep the container running
14
  sleep infinity