Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +12 -10
Dockerfile
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
# Use an official Python runtime as the base image (
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
# Set environment variables
|
|
@@ -22,27 +22,29 @@ RUN apt-get update && apt-get install -y \
|
|
| 22 |
# Set working directory
|
| 23 |
WORKDIR /app
|
| 24 |
|
| 25 |
-
#
|
|
|
|
|
|
|
|
|
|
| 26 |
COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
|
| 27 |
|
| 28 |
-
# Copy
|
| 29 |
COPY . .
|
| 30 |
|
| 31 |
-
#
|
| 32 |
RUN chmod -R 777 /app
|
| 33 |
|
| 34 |
-
# Remove any stale build lock file
|
| 35 |
RUN rm -f /app/.hugo_build.lock
|
| 36 |
|
| 37 |
-
# (Optional)
|
| 38 |
RUN hugo --ignoreCache && hugo mod clean && hugo mod get
|
| 39 |
|
| 40 |
-
# Build the Hugo site (this will generate the public
|
| 41 |
RUN rm -f /app/.hugo_build.lock && hugo
|
| 42 |
|
| 43 |
-
# Expose the port
|
| 44 |
EXPOSE 7860
|
| 45 |
|
| 46 |
-
#
|
| 47 |
-
# as host file permissions can override these settings.
|
| 48 |
CMD ["sh", "-c", "rm -f /app/.hugo_build.lock && hugo server --bind 0.0.0.0 --port 7860 --disableFastRender"]
|
|
|
|
| 1 |
+
# Use an official Python runtime as the base image (for OS utilities)
|
| 2 |
FROM python:3.9-slim
|
| 3 |
|
| 4 |
# Set environment variables
|
|
|
|
| 22 |
# Set working directory
|
| 23 |
WORKDIR /app
|
| 24 |
|
| 25 |
+
# Create /app (if not already) and make sure it's writable
|
| 26 |
+
RUN mkdir -p /app && chmod -R 777 /app
|
| 27 |
+
|
| 28 |
+
# Copy the Hugo theme into /app/themes
|
| 29 |
COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
|
| 30 |
|
| 31 |
+
# Copy the rest of your project files into the container
|
| 32 |
COPY . .
|
| 33 |
|
| 34 |
+
# **Reset permissions for all files inside /app**
|
| 35 |
RUN chmod -R 777 /app
|
| 36 |
|
| 37 |
+
# Remove any stale build lock file (if present)
|
| 38 |
RUN rm -f /app/.hugo_build.lock
|
| 39 |
|
| 40 |
+
# (Optional) If using Hugo Modules, run these commands to clean cache and get modules.
|
| 41 |
RUN hugo --ignoreCache && hugo mod clean && hugo mod get
|
| 42 |
|
| 43 |
+
# Build the Hugo site (this will generate the public directory)
|
| 44 |
RUN rm -f /app/.hugo_build.lock && hugo
|
| 45 |
|
| 46 |
+
# Expose the desired port (7860 in your case)
|
| 47 |
EXPOSE 7860
|
| 48 |
|
| 49 |
+
# At container start, remove any stale build lock file and launch the Hugo server
|
|
|
|
| 50 |
CMD ["sh", "-c", "rm -f /app/.hugo_build.lock && hugo server --bind 0.0.0.0 --port 7860 --disableFastRender"]
|