Fix build: generate settings.json from env vars at runtime
Some checks failed
Deploy / deploy (push) Failing after 53s
Some checks failed
Deploy / deploy (push) Failing after 53s
settings.json is gitignored (contains token). entrypoint.sh writes it from OUTLINE_URL / OUTLINE_TOKEN env vars on container start. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,6 @@
|
|||||||
# Secrets
|
# Secrets
|
||||||
settings.json
|
settings.json
|
||||||
|
.env
|
||||||
|
|
||||||
# Export data (may contain sensitive content)
|
# Export data (may contain sensitive content)
|
||||||
outline_export/
|
outline_export/
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ RUN git config --global user.email "sync@local" && \
|
|||||||
|
|
||||||
WORKDIR /work
|
WORKDIR /work
|
||||||
|
|
||||||
COPY outline_sync.py webui.py settings.json ./
|
COPY outline_sync.py webui.py entrypoint.sh ./
|
||||||
|
RUN chmod +x entrypoint.sh
|
||||||
|
|
||||||
# Initialise vault with both branches needed by outline_sync.py
|
# Initialise vault with both branches needed by outline_sync.py
|
||||||
RUN git init /vault && \
|
RUN git init /vault && \
|
||||||
@@ -31,4 +32,5 @@ RUN git init /vault && \
|
|||||||
|
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
|
|
||||||
|
ENTRYPOINT ["/work/entrypoint.sh"]
|
||||||
CMD ["uvicorn", "webui:app", "--host", "0.0.0.0", "--port", "8080"]
|
CMD ["uvicorn", "webui:app", "--host", "0.0.0.0", "--port", "8080"]
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- domnet
|
- domnet
|
||||||
|
environment:
|
||||||
|
- OUTLINE_URL=${OUTLINE_URL:-http://outline:3000}
|
||||||
|
- OUTLINE_TOKEN=${OUTLINE_TOKEN}
|
||||||
ports:
|
ports:
|
||||||
- "8181:8080"
|
- "8181:8080"
|
||||||
labels:
|
labels:
|
||||||
|
|||||||
15
entrypoint.sh
Normal file
15
entrypoint.sh
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Generate settings.json from environment variables at container start.
|
||||||
|
# OUTLINE_URL and OUTLINE_TOKEN must be set (e.g. via docker-compose env / .env file).
|
||||||
|
|
||||||
|
cat > /work/settings.json <<EOF
|
||||||
|
{
|
||||||
|
"source": { "url": "${OUTLINE_URL}", "token": "${OUTLINE_TOKEN}" },
|
||||||
|
"target": { "url": "${OUTLINE_URL}", "token": "${OUTLINE_TOKEN}" },
|
||||||
|
"sync": { "allow_deletions": false }
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
Reference in New Issue
Block a user