AstraOS commited on
Commit
b9b22dd
·
verified ·
1 Parent(s): 1b3ec01

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +13 -11
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- # Use an official Python runtime as the base image (for minimal OS, even though were not using Python)
2
  FROM python:3.9-slim
3
 
4
  # Set environment variables
@@ -19,7 +19,6 @@ RUN apt-get update && apt-get install -y \
19
  hugo \
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
- # (Optional) Remove Python dependencies if you don't need them for Hugging Face
23
  RUN pip install --no-cache-dir huggingface_hub fastapi uvicorn
24
 
25
  # Install Go
@@ -31,26 +30,29 @@ RUN pip install --no-cache-dir huggingface_hub fastapi uvicorn
31
  # Set Go binary path
32
  # ENV PATH="/usr/local/go/bin:${PATH}"
33
 
34
- # Create and set the working directory for the Hugo site
35
  WORKDIR /app
36
 
 
 
 
37
  # Copy the Hugo theme into the /app/themes directory
38
  COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
39
 
40
- # Copy the rest of your project files into the container
41
  COPY . .
42
 
43
- # Fix permissions so that Hugo can create its build lock file without errors
44
- RUN chmod -R 777 /app
45
 
46
- # Run Hugo module commands to fetch any modules (if your site uses Hugo Modules)
47
  RUN hugo --ignoreCache && hugo mod clean && hugo mod get
48
 
49
- # Build the Hugo site (this will generate the public directory)
50
- RUN hugo
51
 
52
- # Expose the port for the Hugo server (default is 1313, but here we're using 7860 as specified)
53
  EXPOSE 7860
54
 
55
- # Start the Hugo development server, binding to all network interfaces
56
  CMD ["hugo", "server", "--bind", "0.0.0.0", "--port", "7860", "--disableFastRender"]
 
1
+ # Use an official Python runtime as the base image (for minimal OS, even though we're only using Hugo)
2
  FROM python:3.9-slim
3
 
4
  # Set environment variables
 
19
  hugo \
20
  && rm -rf /var/lib/apt/lists/*
21
 
 
22
  RUN pip install --no-cache-dir huggingface_hub fastapi uvicorn
23
 
24
  # Install Go
 
30
  # Set Go binary path
31
  # ENV PATH="/usr/local/go/bin:${PATH}"
32
 
33
+ # Set working directory
34
  WORKDIR /app
35
 
36
+ # Ensure /app exists, is owned by root, and is writable by all users.
37
+ RUN mkdir -p /app && chown -R root:root /app && chmod -R 777 /app
38
+
39
  # Copy the Hugo theme into the /app/themes directory
40
  COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
41
 
42
+ # Copy all project files into the container
43
  COPY . .
44
 
45
+ # Remove any pre-existing build lock file before proceeding.
46
+ RUN rm -f /app/.hugo_build.lock
47
 
48
+ # (Optional) If you're using Hugo Modules, run these commands to clean cache and get modules.
49
  RUN hugo --ignoreCache && hugo mod clean && hugo mod get
50
 
51
+ # Remove the build lock file again, then build the Hugo site.
52
+ RUN rm -f /app/.hugo_build.lock && hugo
53
 
54
+ # Expose the desired port (7860 in your case)
55
  EXPOSE 7860
56
 
57
+ # Start the Hugo server, binding to all interfaces.
58
  CMD ["hugo", "server", "--bind", "0.0.0.0", "--port", "7860", "--disableFastRender"]