William Mattingly commited on
Commit
f51985d
·
1 Parent(s): 3ea294d
Files changed (2) hide show
  1. Dockerfile +97 -0
  2. README.md +1 -0
Dockerfile ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM debian:bullseye-slim
2
+
3
+ # Install required packages
4
+ RUN apt-get update && apt-get install -y --no-install-recommends \
5
+ git \
6
+ ca-certificates \
7
+ curl \
8
+ gnupg \
9
+ lsb-release \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Install Docker
13
+ RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg && \
14
+ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null && \
15
+ apt-get update && apt-get install -y --no-install-recommends \
16
+ docker-ce \
17
+ docker-ce-cli \
18
+ containerd.io \
19
+ docker-compose-plugin \
20
+ && rm -rf /var/lib/apt/lists/*
21
+
22
+ # Create working directory
23
+ WORKDIR /escriptorium
24
+
25
+ # Create setup script
26
+ RUN echo '#!/bin/bash\n\
27
+ set -e\n\
28
+ \n\
29
+ # Clone the repository if it doesn't exist\n\
30
+ if [ ! -d ".git" ]; then\n\
31
+ git clone https://gitlab.com/scripta/escriptorium.git .\n\
32
+ fi\n\
33
+ \n\
34
+ # Copy variables.env if it doesn't exist\n\
35
+ if [ ! -f "variables.env" ]; then\n\
36
+ cp variables.env_example variables.env\n\
37
+ fi\n\
38
+ \n\
39
+ # Pull the Docker images\n\
40
+ docker compose pull\n\
41
+ \n\
42
+ # Start the services\n\
43
+ docker compose up -d\n\
44
+ \n\
45
+ echo "eScriptorium is now running!"\n\
46
+ echo "You can access it at http://localhost:8080"\n\
47
+ ' > /escriptorium/setup.sh && chmod +x /escriptorium/setup.sh
48
+
49
+ # Create update script
50
+ RUN echo '#!/bin/bash\n\
51
+ set -e\n\
52
+ \n\
53
+ echo "Updating eScriptorium..."\n\
54
+ \n\
55
+ # Pull latest changes\n\
56
+ git pull\n\
57
+ \n\
58
+ # Pull latest Docker images\n\
59
+ docker compose pull\n\
60
+ \n\
61
+ # Restart services\n\
62
+ docker compose up -d\n\
63
+ \n\
64
+ echo "Update completed!"\n\
65
+ ' > /escriptorium/update.sh && chmod +x /escriptorium/update.sh
66
+
67
+ # Create entrypoint script
68
+ RUN echo '#!/bin/bash\n\
69
+ # Start Docker daemon\n\
70
+ dockerd &\n\
71
+ \n\
72
+ # Wait for Docker to start\n\
73
+ timeout=30\n\
74
+ while ! docker info >/dev/null 2>&1; do\n\
75
+ timeout=$((timeout - 1))\n\
76
+ if [ $timeout -eq 0 ]; then\n\
77
+ echo "Docker daemon failed to start"\n\
78
+ exit 1\n\
79
+ fi\n\
80
+ sleep 1\n\
81
+ done\n\
82
+ \n\
83
+ # Run setup script\n\
84
+ /escriptorium/setup.sh\n\
85
+ \n\
86
+ # Keep container running\n\
87
+ tail -f /dev/null\n\
88
+ ' > /escriptorium/entrypoint.sh && chmod +x /escriptorium/entrypoint.sh
89
+
90
+ # Set volumes
91
+ VOLUME ["/escriptorium", "/var/lib/docker"]
92
+
93
+ # Expose ports
94
+ EXPOSE 8080
95
+
96
+ # Run the entrypoint script
97
+ ENTRYPOINT ["/escriptorium/entrypoint.sh"]
README.md CHANGED
@@ -5,6 +5,7 @@ colorFrom: indigo
5
  colorTo: red
6
  sdk: docker
7
  pinned: false
 
8
  ---
9
 
10
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
5
  colorTo: red
6
  sdk: docker
7
  pinned: false
8
+ app_port: 8080
9
  ---
10
 
11
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference