Skip to content

Commit

Permalink
fix(docs): generate OpenAPI schema in staticbuilder
Browse files Browse the repository at this point in the history
Refs: LINK-1904
  • Loading branch information
harriris-vincit committed Sep 12, 2024
1 parent 8df7b1b commit ebc2794
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 7 additions & 1 deletion docker/django/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ FROM appbase AS staticbuilder

ENV VAR_ROOT=/app
COPY --chown=appuser:appuser . /app
RUN SECRET_KEY="only-used-for-collectstatic" python manage.py collectstatic --noinput

RUN mkdir -p /app/linkedevents/static \
&& touch /app/linkedevents/static/openapi_schema.yaml \
&& SECRET_KEY="only-used-for-collectstatic" python manage.py spectacular \
--file /app/linkedevents/static/openapi_schema.yaml --lang en --validate --fail-on-warn \
--api-version v1 \
&& SECRET_KEY="only-used-for-collectstatic" python manage.py collectstatic --noinput

# ==============================
FROM appbase AS production
Expand Down
7 changes: 0 additions & 7 deletions docker/django/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ if [[ "$COMPILE_TRANSLATIONS" = "true" ]]; then
django-admin compilemessages
fi

if [[ "$SWAGGER_USE_STATIC_SCHEMA" = "true" ]]; then
echo "Generating static OpenAPI schema..."
mkdir -p ./linkedevents/static
touch ./linkedevents/static/openapi_schema.yaml
./manage.py spectacular --file ./linkedevents/static/openapi_schema.yaml --lang en --validate --fail-on-warn --api-version v1
fi

# Allow running arbitrary commands instead of the servers
if [[ -n "$@" ]]; then
"$@"
Expand Down

0 comments on commit ebc2794

Please sign in to comment.