AstraOS commited on
Commit
43db0b4
·
verified ·
1 Parent(s): 269adcf

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -21
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- # Use an official Python runtime as the base image (we're using it just for OS utilities)
2
  FROM python:3.9-slim
3
 
4
  # Set environment variables
@@ -6,7 +6,7 @@ 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 \
@@ -19,35 +19,30 @@ RUN apt-get update && apt-get install -y \
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
25
- # RUN curl -sSL https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz -o go${GO_VERSION}.tar.gz \
26
- # && tar -xvzf go${GO_VERSION}.tar.gz \
27
- # && mv go /usr/local/ \
28
- # && rm go${GO_VERSION}.tar.gz
29
-
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 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"]
 
1
+ # Use an official Python runtime as the base image (using it here only for OS utilities)
2
  FROM python:3.9-slim
3
 
4
  # Set environment variables
 
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 \
 
19
  hugo \
20
  && rm -rf /var/lib/apt/lists/*
21
 
 
 
 
 
 
 
 
 
 
 
 
22
  # Set working directory
23
  WORKDIR /app
24
 
25
+ # Copy the Hugo theme into the /app/themes directory
 
 
 
26
  COPY ./app/themes/hugo-theme-stack /app/themes/hugo-theme-stack
27
+
28
+ # Copy all project files into the container
29
  COPY . .
30
 
31
+ # Ensure that all files and folders in /app are writable
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) Run Hugo module commands if you’re using Hugo Modules
38
+ RUN hugo --ignoreCache && hugo mod clean && hugo mod get
39
+
40
+ # Build the Hugo site (this will generate the public folder and compiled resources)
41
+ RUN rm -f /app/.hugo_build.lock && hugo
42
 
43
  # Expose the port Hugo will use
44
  EXPOSE 7860
45
 
46
+ # Start the Hugo server. Note: Avoid mounting a host directory on /app when running the container,
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"]