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

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -17
Dockerfile CHANGED
@@ -1,12 +1,12 @@
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
5
  ENV LANG C.UTF-8
6
  ENV GO_VERSION 1.23.0
7
  ENV HUGO_VERSION latest
8
 
9
- # Install system dependencies, including Hugo and its requirements
10
  RUN apt-get update && apt-get install -y \
11
  curl \
12
  git \
@@ -33,26 +33,21 @@ RUN pip install --no-cache-dir huggingface_hub fastapi uvicorn
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"]
 
1
+ # Use an official Python runtime as the base image (we're using it just for OS utilities)
2
+ FROM gohugoio/hugo:0.111.3-ext-alpine
3
 
4
  # Set environment variables
5
  ENV LANG C.UTF-8
6
  ENV GO_VERSION 1.23.0
7
  ENV HUGO_VERSION latest
8
 
9
+ # Install system dependencies including Hugo and its requirements
10
  RUN apt-get update && apt-get install -y \
11
  curl \
12
  git \
 
33
  # Set working directory
34
  WORKDIR /app
35
 
36
+ # Ensure /app is writable (make sure no host volume is mounted over /app at runtime)
37
+ RUN mkdir -p /app && chmod -R 777 /app
38
 
39
+ # Copy your Hugo theme into /app/themes and the rest of your project files
40
  COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
 
 
41
  COPY . .
42
 
43
+ # Remove any stale build lock file (if present)
44
  RUN rm -f /app/.hugo_build.lock
45
 
46
+ # Run Hugo module commands and build the site
47
+ RUN hugo --ignoreCache && hugo mod clean && hugo mod get && rm -f /app/.hugo_build.lock && hugo
 
 
 
48
 
49
+ # Expose the port Hugo will use
50
  EXPOSE 7860
51
 
52
+ # At container start, remove any stale build lock file and launch Hugo server
53
+ CMD ["sh", "-c", "rm -f /app/.hugo_build.lock && hugo server --bind 0.0.0.0 --port 7860 --disableFastRender"]