Spaces:
Sleeping
Sleeping
Sync from GitHub via hub-sync
Browse files- Dockerfile +6 -9
- README.md +3 -11
- docker-compose.yml +2 -6
- infra/bicep/main.bicep +0 -4
Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
FROM python:3.11-slim
|
| 2 |
|
| 3 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 4 |
PYTHONUNBUFFERED=1 \
|
|
@@ -6,9 +6,6 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
| 6 |
PYTHONPATH=/app/src \
|
| 7 |
FACEVERIFICATION_DEVICE=cpu
|
| 8 |
|
| 9 |
-
ARG APP_VARIANT=gradio
|
| 10 |
-
ENV APP_VARIANT=${APP_VARIANT}
|
| 11 |
-
|
| 12 |
WORKDIR /app
|
| 13 |
|
| 14 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
@@ -31,8 +28,8 @@ USER appuser
|
|
| 31 |
|
| 32 |
EXPOSE 8000 7860
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
|
|
|
| 1 |
+
FROM python:3.11-slim AS app
|
| 2 |
|
| 3 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
| 4 |
PYTHONUNBUFFERED=1 \
|
|
|
|
| 6 |
PYTHONPATH=/app/src \
|
| 7 |
FACEVERIFICATION_DEVICE=cpu
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
|
|
| 28 |
|
| 29 |
EXPOSE 8000 7860
|
| 30 |
|
| 31 |
+
FROM app AS fastapi
|
| 32 |
+
CMD ["uvicorn", "faceverification.interfaces.fastapi_app:app", "--host", "0.0.0.0", "--port", "8000"]
|
| 33 |
+
|
| 34 |
+
FROM app AS gradio
|
| 35 |
+
CMD ["python", "-m", "faceverification.interfaces.gradio_app"]
|
README.md
CHANGED
|
@@ -156,7 +156,9 @@ docker compose --profile gradio up --build
|
|
| 156 |
|
| 157 |
The Gradio UI will be available at http://localhost:7860.
|
| 158 |
|
| 159 |
-
Both services are built from the same `Dockerfile`
|
|
|
|
|
|
|
| 160 |
|
| 161 |
- `fastapi`: published to GHCR by the container workflow.
|
| 162 |
- `gradio`: used by the Hugging Face Docker Space.
|
|
@@ -240,16 +242,6 @@ FACEVERIFICATION_DEMO_PASSWORD
|
|
| 240 |
FACEVERIFICATION_JWT_SECRET_KEY
|
| 241 |
```
|
| 242 |
|
| 243 |
-
Optional GitHub repository secrets for private GHCR packages:
|
| 244 |
-
|
| 245 |
-
```text
|
| 246 |
-
GHCR_PULL_USERNAME
|
| 247 |
-
GHCR_PULL_TOKEN
|
| 248 |
-
```
|
| 249 |
-
|
| 250 |
-
If the GHCR package is public, those optional secrets can be omitted. If it is
|
| 251 |
-
private, `GHCR_PULL_TOKEN` must be a GitHub token with package read access.
|
| 252 |
-
|
| 253 |
To avoid ongoing cost while keeping the OIDC and RBAC setup intact, remove the
|
| 254 |
demo resources inside the configured resource group from Azure when they are no
|
| 255 |
longer needed.
|
|
|
|
| 156 |
|
| 157 |
The Gradio UI will be available at http://localhost:7860.
|
| 158 |
|
| 159 |
+
Both services are built from the same `Dockerfile`. The heavy application
|
| 160 |
+
layers live in the shared `app` stage; the `fastapi` and `gradio` stages only
|
| 161 |
+
set different default commands:
|
| 162 |
|
| 163 |
- `fastapi`: published to GHCR by the container workflow.
|
| 164 |
- `gradio`: used by the Hugging Face Docker Space.
|
|
|
|
| 242 |
FACEVERIFICATION_JWT_SECRET_KEY
|
| 243 |
```
|
| 244 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
To avoid ongoing cost while keeping the OIDC and RBAC setup intact, remove the
|
| 246 |
demo resources inside the configured resource group from Azure when they are no
|
| 247 |
longer needed.
|
docker-compose.yml
CHANGED
|
@@ -2,10 +2,8 @@ services:
|
|
| 2 |
api:
|
| 3 |
build:
|
| 4 |
context: .
|
| 5 |
-
|
| 6 |
-
APP_VARIANT: fastapi
|
| 7 |
image: faceverification:fastapi
|
| 8 |
-
command: uvicorn faceverification.interfaces.fastapi_app:app --host 0.0.0.0 --port 8000
|
| 9 |
ports:
|
| 10 |
- "8000:8000"
|
| 11 |
environment:
|
|
@@ -23,10 +21,8 @@ services:
|
|
| 23 |
gradio:
|
| 24 |
build:
|
| 25 |
context: .
|
| 26 |
-
|
| 27 |
-
APP_VARIANT: gradio
|
| 28 |
image: faceverification:gradio
|
| 29 |
-
command: python -m faceverification.interfaces.gradio_app
|
| 30 |
profiles:
|
| 31 |
- gradio
|
| 32 |
ports:
|
|
|
|
| 2 |
api:
|
| 3 |
build:
|
| 4 |
context: .
|
| 5 |
+
target: fastapi
|
|
|
|
| 6 |
image: faceverification:fastapi
|
|
|
|
| 7 |
ports:
|
| 8 |
- "8000:8000"
|
| 9 |
environment:
|
|
|
|
| 21 |
gradio:
|
| 22 |
build:
|
| 23 |
context: .
|
| 24 |
+
target: gradio
|
|
|
|
| 25 |
image: faceverification:gradio
|
|
|
|
| 26 |
profiles:
|
| 27 |
- gradio
|
| 28 |
ports:
|
infra/bicep/main.bicep
CHANGED
|
@@ -129,10 +129,6 @@ resource app 'Microsoft.App/containerApps@2024-03-01' = {
|
|
| 129 |
name: 'api'
|
| 130 |
image: image
|
| 131 |
env: [
|
| 132 |
-
{
|
| 133 |
-
name: 'APP_VARIANT'
|
| 134 |
-
value: 'fastapi'
|
| 135 |
-
}
|
| 136 |
{
|
| 137 |
name: 'FACEVERIFICATION_DEVICE'
|
| 138 |
value: 'cpu'
|
|
|
|
| 129 |
name: 'api'
|
| 130 |
image: image
|
| 131 |
env: [
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
{
|
| 133 |
name: 'FACEVERIFICATION_DEVICE'
|
| 134 |
value: 'cpu'
|