-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
37 lines (27 loc) · 982 Bytes
/
Copy pathDockerfile
File metadata and controls
37 lines (27 loc) · 982 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
FROM ruby:3.1-slim
# Install essential Linux packages
RUN apt-get update && apt-get install -y \
build-essential \
git \
nodejs \
&& rm -rf /var/lib/apt/lists/*
# Set working directory
WORKDIR /app
# Create a non-root user with the same UID/GID as the host user
RUN addgroup --gid 1000 jekyll && \
adduser --uid 1000 --gid 1000 --disabled-password --gecos "" jekyll && \
chown -R jekyll:jekyll /app
# Switch to non-root user
USER jekyll
# Copy Gemfile and Gemfile.lock first (for better caching)
COPY --chown=jekyll:jekyll Gemfile* ./
# Install Jekyll and dependencies
RUN bundle install
# Copy the rest of the application
COPY --chown=jekyll:jekyll . .
# Expose port 4000
EXPOSE 4000
# Use ENTRYPOINT instead of CMD to start the Jekyll server
ENTRYPOINT ["bundle", "exec", "jekyll", "serve", "--host", "0.0.0.0","--incremental"]
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD curl -f http://localhost:4000 || exit 1