File size: 3,285 Bytes
3ef9463
b945800
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d658154
258fd02
b945800
 
 
 
d658154
258fd02
b945800
 
 
 
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import os
from flask import Flask, render_template_string

app = Flask(__name__)

# HTML Template with embedded CSS for a clean look
HTML_TEMPLATE = """
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Docker on Hugging Face Spaces</title>
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
            margin: 0;
            padding: 0;
            background-color: #f5f5f5;
            color: #333;
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }
        /* Header Styling */
        header {
            background-color: #fff;
            padding: 1rem 2rem;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
            display: flex;
            justify-content: flex-start;
            align-items: center;
        }
        .brand-link {
            text-decoration: none;
            color: #007bff;
            font-weight: 600;
            font-size: 1rem;
            transition: color 0.2s;
        }
        .brand-link:hover {
            color: #0056b3;
            text-decoration: underline;
        }
        /* Main Content Styling */
        main {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 2rem;
            text-align: center;
        }
        .card {
            background: white;
            padding: 3rem;
            border-radius: 12px;
            box-shadow: 0 4px 6px rgba(0,0,0,0.05);
            max-width: 600px;
            width: 100%;
        }
        h1 {
            margin-top: 0;
            color: #111;
        }
        p {
            color: #666;
            line-height: 1.6;
        }
        .status-badge {
            display: inline-block;
            margin-top: 1rem;
            padding: 0.25rem 0.75rem;
            background-color: #e6fffa;
            color: #047481;
            border-radius: 9999px;
            font-size: 0.875rem;
            font-weight: 500;
        }
    </style>
</head>
<body>

    <!-- Header Section with Required Link -->
    <header>
        <a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="brand-link">
            Built with anycoder
        </a>
    </header>

    <!-- Main Content -->
    <main>
        <div class="card">
            <h1>Docker Space Running</h1>
            <p>
                Your containerized application is successfully running on Hugging Face Spaces. 
                This page is being served by a Flask application running inside a Docker container.
            </p>
            <div class="status-badge">● System Operational</div>
        </div>
    </main>

</body>
</html>
"""

@app.route("/")
def home():
    """Render the main landing page."""
    return render_template_string(HTML_TEMPLATE)

if __name__ == "__main__":
    # Hugging Face Spaces expects the app to run on port 7860
    # We bind to 0.0.0.0 to accept connections from outside the container
    port = int(os.environ.get("PORT", 7860))
    app.run(host="0.0.0.0", port=port)