Spaces:
Running
Running
luanpoppe
commited on
Commit
·
0018f4b
1
Parent(s):
edd5b40
feat: adicionando comando para criar as credentials do google
Browse files- .env.example +2 -1
- Dockerfile +8 -0
- entrypoint.sh +23 -0
.env.example
CHANGED
@@ -12,4 +12,5 @@ DEEPSEEKK_API_KEY=""
|
|
12 |
GOOGLE_API_KEY_PEIXE=""
|
13 |
SENTRY_DSN=""
|
14 |
AMBIENTE="testes"
|
15 |
-
GOOGLE_APPLICATION_CREDENTIALS=""
|
|
|
|
12 |
GOOGLE_API_KEY_PEIXE=""
|
13 |
SENTRY_DSN=""
|
14 |
AMBIENTE="testes"
|
15 |
+
GOOGLE_APPLICATION_CREDENTIALS=""
|
16 |
+
GCP_CREDENTIALS_JSON_CONTENT="Conteúdo inteiro do arquivo vella_gcp_luan_credentials.json"
|
Dockerfile
CHANGED
@@ -11,6 +11,10 @@ COPY --chown=user . ./app
|
|
11 |
|
12 |
WORKDIR /app
|
13 |
|
|
|
|
|
|
|
|
|
14 |
RUN pip install --no-cache-dir -r requirements.txt
|
15 |
|
16 |
# RUN python3 -m venv /app/.venv
|
@@ -23,6 +27,10 @@ RUN pip install --no-cache-dir -r requirements.txt
|
|
23 |
RUN python manage.py collectstatic --noinput
|
24 |
|
25 |
RUN pip install uvicorn
|
|
|
|
|
|
|
|
|
26 |
CMD ["uvicorn", "setup.asgi:application", "--host", "0.0.0.0", "--port", "7860"]
|
27 |
|
28 |
# ENTRYPOINT ["python", "manage.py", "runserver"]
|
|
|
11 |
|
12 |
WORKDIR /app
|
13 |
|
14 |
+
# Copy the entrypoint script and make it executable
|
15 |
+
COPY entrypoint.sh /entrypoint.sh
|
16 |
+
RUN chmod +x /entrypoint.sh
|
17 |
+
|
18 |
RUN pip install --no-cache-dir -r requirements.txt
|
19 |
|
20 |
# RUN python3 -m venv /app/.venv
|
|
|
27 |
RUN python manage.py collectstatic --noinput
|
28 |
|
29 |
RUN pip install uvicorn
|
30 |
+
|
31 |
+
# Set the entrypoint to our script
|
32 |
+
ENTRYPOINT ["/entrypoint.sh"]
|
33 |
+
|
34 |
CMD ["uvicorn", "setup.asgi:application", "--host", "0.0.0.0", "--port", "7860"]
|
35 |
|
36 |
# ENTRYPOINT ["python", "manage.py", "runserver"]
|
entrypoint.sh
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/bin/sh
|
2 |
+
set -e # Exit immediately if a command exits with a non-zero status.
|
3 |
+
|
4 |
+
# Path where the credentials file will be written inside the container
|
5 |
+
CREDENTIALS_FILE_PATH="/app/vella_gcp_luan_credentials.json" # Or /tmp/vella_gcp_luan_credentials.json
|
6 |
+
|
7 |
+
# Check if the GCP_CREDENTIALS_JSON_CONTENT secret is provided
|
8 |
+
if [ -n "$GCP_CREDENTIALS_JSON_CONTENT" ]; then
|
9 |
+
echo "GCP_CREDENTIALS_JSON_CONTENT secret found. Writing to $CREDENTIALS_FILE_PATH"
|
10 |
+
# Write the content of the environment variable (the JSON string) to the file
|
11 |
+
echo "$GCP_CREDENTIALS_JSON_CONTENT" > "$CREDENTIALS_FILE_PATH"
|
12 |
+
# Export GOOGLE_APPLICATION_CREDENTIALS to point to this new file
|
13 |
+
export GOOGLE_APPLICATION_CREDENTIALS="$CREDENTIALS_FILE_PATH"
|
14 |
+
echo "GOOGLE_APPLICATION_CREDENTIALS set to $CREDENTIALS_FILE_PATH"
|
15 |
+
else
|
16 |
+
echo "Warning: GCP_CREDENTIALS_JSON_CONTENT secret not found. GCP services might not authenticate."
|
17 |
+
# You could choose to exit here if credentials are absolutely mandatory:
|
18 |
+
# echo "Error: GCP_CREDENTIALS_JSON_CONTENT secret is required. Exiting." >&2
|
19 |
+
# exit 1
|
20 |
+
fi
|
21 |
+
|
22 |
+
# Now, execute the command passed to this script (which will be your uvicorn CMD)
|
23 |
+
exec "$@"
|