This repository was archived by the owner on Jun 5, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +31
-15
lines changed Expand file tree Collapse file tree 2 files changed +31
-15
lines changed Original file line number Diff line number Diff line change @@ -32,20 +32,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
32
32
33
33
WORKDIR /usr/src/
34
34
35
- # Get the latest commit sha as a build arg
36
- # This is needed otherwise Docker will cache the git clone step. With this workaround
37
- # we can force Docker to re-run the git clone step if the latest commit sha changes.
38
- # --build-arg LATEST_COMMIT_SHA=$(curl \
39
- # -LSsk "https://api.github.com/repos/stacklok/codegate-ui/commits?per_page=1" \
40
- # -H "Authorization: Bearer $GH_CI_TOKEN" | jq -r '.[0].sha')
41
- ARG LATEST_COMMIT_SHA=LATEST
42
- RUN echo "Latest FE commit: $LATEST_COMMIT_SHA"
43
- # Download the webapp from GH
44
- # -L to follow redirects
35
+ # Get the latest release of the webapp from GH
45
36
RUN --mount=type=secret,id=gh_token \
46
- LATEST_COMMIT_SHA=${LATEST_COMMIT_SHA} \
47
- curl -L -o main.zip "https://api.github.com/repos/stacklok/codegate-ui/zipball/main" \
48
- -H "Authorization: Bearer $(cat /run/secrets/gh_token)"
37
+ curl -s -H "Authorization: Bearer $(cat /run/secrets/gh_token)" https://api.github.com/repos/stacklok/codegate-ui/releases/latest \
38
+ | grep '"zipball_url":' \
39
+ | cut -d '"' -f 4 \
40
+ | xargs -n 1 -I {} curl -L -H "Authorization: Bearer $(cat /run/secrets/gh_token)" -o main.zip {}
49
41
50
42
# Extract the downloaded zip file
51
43
RUN unzip main.zip
Original file line number Diff line number Diff line change @@ -6,7 +6,31 @@ BACKUP_NAME="backup"
6
6
MODEL_BASE_PATH=" /app/codegate_volume/models"
7
7
CODEGATE_DB_FILE=" /app/codegate_volume/db/codegate.db"
8
8
CODEGATE_CERTS=" /app/codegate_volume/certs"
9
- WEBAPP=" /usr/src/webapp"
9
+ NGINX_CA_CERT=" /usr/share/nginx/html/certificates"
10
+
11
+ # Function to ensure the certificates directory exists and copy the certificate
12
+ setup_certificate () {
13
+ echo " Ensuring the Nginx certificates directory exists..."
14
+ mkdir -p " $NGINX_CA_CERT " # Ensure the directory exists
15
+
16
+ # Check if the source certificate exists
17
+ if [ ! -f " $CODEGATE_CERTS /ca.crt" ]; then
18
+ echo " Error: Certificate file not found at $CODEGATE_CERTS /ca.crt"
19
+ exit 1
20
+ fi
21
+
22
+ echo " Copying CA certificate to $NGINX_CA_CERT ..."
23
+ cp " $CODEGATE_CERTS /ca.crt" " $NGINX_CA_CERT /codegate_ca.crt"
24
+
25
+ # Verify the copy was successful
26
+ if [ -f " $NGINX_CA_CERT /codegate_ca.crt" ]; then
27
+ echo " CA certificate successfully copied to $NGINX_CA_CERT "
28
+ else
29
+ echo " Error: Failed to copy CA certificate."
30
+ exit 1
31
+ fi
32
+ }
33
+
10
34
11
35
# Function to restore backup if paths are provided
12
36
restore_backup () {
@@ -64,7 +88,7 @@ restore_backup
64
88
genrerate_certs
65
89
66
90
# Step 3: Make CA available to UI
67
- cp " $CODEGATE_CERTS /ca.crt " " $WEBAPP /public/certificates/codegate_ca.crt "
91
+ setup_certificate
68
92
69
93
# Step 4: Start the dashboard
70
94
start_dashboard
You can’t perform that action at this time.
0 commit comments