Spaces:
Sleeping
Sleeping
z90486091
commited on
Commit
·
e2feace
1
Parent(s):
8f8742d
updated
Browse files- Dockerfile +7 -16
- entrypoint.sh +13 -0
Dockerfile
CHANGED
|
@@ -1,20 +1,11 @@
|
|
| 1 |
-
FROM ghcr.io/anomalyco/opencode:latest
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
|
|
|
|
| 8 |
|
| 9 |
-
|
| 10 |
-
# Create startup script to set secret at runtime
|
| 11 |
-
RUN echo '#!/bin/sh' > /entrypoint.sh && \
|
| 12 |
-
echo 'if [ -n "$HF_OPENCODE_PASSWORD" ]; then' >> /entrypoint.sh && \
|
| 13 |
-
echo ' export OPENCODE_SERVER_PASSWORD="$HF_OPENCODE_PASSWORD"' >> /entrypoint.sh && \
|
| 14 |
-
echo 'fi' >> /entrypoint.sh && \
|
| 15 |
-
echo 'exec opencode "$@"' >> /entrypoint.sh && \
|
| 16 |
-
chmod +x /entrypoint.sh
|
| 17 |
-
|
| 18 |
ENTRYPOINT ["/entrypoint.sh"]
|
| 19 |
-
|
| 20 |
-
CMD ["web", "--port", "8860", "--hostname", "0.0.0.0"]
|
|
|
|
| 1 |
+
FROM ghcr.io/anomalyco/opencode:latest
|
| 2 |
|
| 3 |
+
ENV OPENCODE_SERVER_USERNAME=opencode
|
| 4 |
+
EXPOSE 8860
|
| 5 |
|
| 6 |
+
# Copy the entrypoint script and make it executable
|
| 7 |
+
COPY entrypoint.sh /entrypoint.sh
|
| 8 |
+
RUN chmod +x /entrypoint.sh
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
ENTRYPOINT ["/entrypoint.sh"]
|
| 11 |
+
CMD ["web", "--port", "8860", "--hostname", "0.0.0.0"]
|
|
|
entrypoint.sh
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/sh
|
| 2 |
+
# Set authentication from HuggingFace secret
|
| 3 |
+
if [ -n "$HF_OPENCODE_PASSWORD" ]; then
|
| 4 |
+
export OPENCODE_SERVER_PASSWORD="$HF_OPENCODE_PASSWORD"
|
| 5 |
+
fi
|
| 6 |
+
|
| 7 |
+
# Set custom configuration from environment variable
|
| 8 |
+
if [ -n "$OC_CONFIG_JSON" ]; then
|
| 9 |
+
export OPENCODE_CONFIG_CONTENT="$OC_CONFIG_JSON"
|
| 10 |
+
fi
|
| 11 |
+
|
| 12 |
+
# Execute opencode with passed arguments
|
| 13 |
+
exec opencode "$@"
|