Spaces:
Sleeping
Sleeping
Nicky Nicolson
commited on
Commit
·
91aa31c
1
Parent(s):
3f1b55c
switch to 2 stage build
Browse files- Dockerfile +13 -41
Dockerfile
CHANGED
|
@@ -1,41 +1,13 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
RUN
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
# GBIF dockerfile
|
| 16 |
-
ENV JEKYLL_UID=0 \
|
| 17 |
-
JEKYLL_GID=0 \
|
| 18 |
-
JEKYLL_ROOTLESS=1 \
|
| 19 |
-
TZ=UTC
|
| 20 |
-
|
| 21 |
-
# GBIF dockerfile
|
| 22 |
-
RUN apk --no-cache add curl && \
|
| 23 |
-
curl -Ss --output-dir /srv/jekyll/ --remote-name --fail https://raw.githubusercontent.com/gbif/hp-template/master/Gemfile && \
|
| 24 |
-
curl -Ss --output-dir /srv/jekyll/ --remote-name --fail https://raw.githubusercontent.com/gbif/hp-template/master/Gemfile.lock && \
|
| 25 |
-
/usr/local/bin/bundle config set frozen true && \
|
| 26 |
-
/usr/local/bin/bundle install
|
| 27 |
-
|
| 28 |
-
# Disable problematic entrypoint scripts
|
| 29 |
-
RUN rm -rf /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh \
|
| 30 |
-
/docker-entrypoint.d/20-envsubst-on-templates.sh
|
| 31 |
-
|
| 32 |
-
# Create the site directory and set permissions
|
| 33 |
-
RUN mkdir -p /site && chown -R jekyll:jekyll /site
|
| 34 |
-
|
| 35 |
-
# Switch to the jekyll user (avoid root issues)
|
| 36 |
-
USER jekyll
|
| 37 |
-
|
| 38 |
-
WORKDIR /site
|
| 39 |
-
RUN jekyll build
|
| 40 |
-
|
| 41 |
-
RUN echo "here"
|
|
|
|
| 1 |
+
# Muitistage Dockerfile to first build the static site, then using nginx serve the static site
|
| 2 |
+
FROM ruby:3.4.3 as builder
|
| 3 |
+
WORKDIR /usr/src/app
|
| 4 |
+
COPY Gemfile jekyll-theme-chirpy.gemspec ./
|
| 5 |
+
RUN bundle install
|
| 6 |
+
COPY . .
|
| 7 |
+
RUN bundle exec jekyll build
|
| 8 |
+
|
| 9 |
+
#Copy _sites from build to Nginx Container to serve site
|
| 10 |
+
FROM nginx:latest
|
| 11 |
+
COPY --from=builder /usr/src/app/_site /usr/share/nginx/html
|
| 12 |
+
EXPOSE 80
|
| 13 |
+
CMD ["nginx", "-g", "daemon off;"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|