All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 12m0s
71 lines
2.5 KiB
Docker
71 lines
2.5 KiB
Docker
# syntax=docker/dockerfile:1
|
|
|
|
FROM python:3.11-slim AS base
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PYTHONPATH=/app \
|
|
PIP_NO_CACHE_DIR=1 \
|
|
APP_PORT=8000 \
|
|
APP_MODULE=app:app
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates nodejs \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
COPY shared/requirements.txt ./requirements.txt
|
|
RUN pip install -r requirements.txt && \
|
|
pip install pytest pytest-json-report
|
|
|
|
# Shared code (including tests)
|
|
COPY shared/ ./shared/
|
|
|
|
# App code — test dashboard (from test-sx-web/ in build context)
|
|
COPY test-sx-web/ ./test-app-tmp/
|
|
RUN cp -r test-app-tmp/app.py test-app-tmp/path_setup.py \
|
|
test-app-tmp/bp test-app-tmp/sx test-app-tmp/services \
|
|
test-app-tmp/runner.py test-app-tmp/__init__.py ./ 2>/dev/null || true && \
|
|
([ -d test-app-tmp/sxc ] && cp -r test-app-tmp/sxc ./ || true) && \
|
|
rm -rf test-app-tmp
|
|
|
|
# sx_docs app code (for its tests, if any)
|
|
COPY sx/ ./sx-app-tmp/
|
|
RUN mkdir -p sx_docs && \
|
|
([ -d sx-app-tmp/tests ] && cp -r sx-app-tmp/tests sx_docs/ || true) && \
|
|
([ -d sx-app-tmp/sx ] && cp -r sx-app-tmp/sx sx_docs/sx || true) && \
|
|
([ -d sx-app-tmp/sxc ] && cp -r sx-app-tmp/sxc sx_docs/sxc || true) && \
|
|
([ -d sx-app-tmp/content ] && cp -r sx-app-tmp/content sx_docs/content || true) && \
|
|
([ -f sx-app-tmp/__init__.py ] && cp sx-app-tmp/__init__.py sx_docs/ || true) && \
|
|
rm -rf sx-app-tmp
|
|
|
|
# Sibling models for cross-domain SQLAlchemy imports
|
|
COPY blog/__init__.py ./blog/__init__.py
|
|
COPY blog/models/ ./blog/models/
|
|
COPY market/__init__.py ./market/__init__.py
|
|
COPY market/models/ ./market/models/
|
|
COPY cart/__init__.py ./cart/__init__.py
|
|
COPY cart/models/ ./cart/models/
|
|
COPY events/__init__.py ./events/__init__.py
|
|
COPY events/models/ ./events/models/
|
|
COPY federation/__init__.py ./federation/__init__.py
|
|
COPY federation/models/ ./federation/models/
|
|
COPY account/__init__.py ./account/__init__.py
|
|
COPY account/models/ ./account/models/
|
|
COPY relations/__init__.py ./relations/__init__.py
|
|
COPY relations/models/ ./relations/models/
|
|
COPY likes/__init__.py ./likes/__init__.py
|
|
COPY likes/models/ ./likes/models/
|
|
COPY orders/__init__.py ./orders/__init__.py
|
|
COPY orders/models/ ./orders/models/
|
|
|
|
COPY test-sx-web/entrypoint.sh /usr/local/bin/entrypoint.sh
|
|
RUN chmod +x /usr/local/bin/entrypoint.sh
|
|
|
|
RUN useradd -m -u 10001 appuser && chown -R appuser:appuser /app
|
|
USER appuser
|
|
|
|
EXPOSE ${APP_PORT}
|
|
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
|