-
Notifications
You must be signed in to change notification settings - Fork 601
Expand file tree
/
Copy pathDockerfile
More file actions
51 lines (41 loc) · 1.73 KB
/
Dockerfile
File metadata and controls
51 lines (41 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Use the uv Python 3.11 slim base image
FROM ghcr.io/astral-sh/uv:0.9.28-python3.11-bookworm-slim
# Set working directory
WORKDIR /app
# Install git and other dependencies
RUN apt-get update && apt-get install -y \
git \
&& rm -rf /var/lib/apt/lists/*
# Clone the OAuth2 server example
RUN git clone https://github.com/authlib/example-oauth2-server.git oauth2-server
# Apply patches: add an explicit Cancel button to the authorize route and
# template so that declining the OAuth2 consent redirects back with
# error=access_denied instead of leaving the client app waiting indefinitely.
COPY patches/oauth2-server.patch /tmp/oauth2-server.patch
RUN patch -p1 -d /app/oauth2-server < /tmp/oauth2-server.patch
# Change to the OAuth2 server directory
WORKDIR /app/oauth2-server
# Install Python dependencies
RUN uv sync
# Set environment variables for development
ENV AUTHLIB_INSECURE_TRANSPORT=1
ENV FLASK_APP=app.py
ENV FLASK_ENV=development
# Expose port 5000
EXPOSE 5000
# Start the Flask OAuth2 server
CMD [ "uv", "run", "flask", "run", "--host=0.0.0.0", "--port=5000"]