Spaces:
Sleeping
Sleeping
| # Muitistage Dockerfile to first build the static site, then using nginx serve the static site | |
| FROM ruby:3.4.3 as builder | |
| # GBIF dockerfile | |
| RUN gem sources --add https://repository.gbif.org/repository/rubygems.org/ && \ | |
| gem sources --remove https://rubygems.org/ | |
| RUN bundle config set mirror.https://rubygems.org https://repository.gbif.org/repository/rubygems.org | |
| WORKDIR /usr/src/app | |
| COPY Gemfile ./ | |
| # RUN bundle config set frozen true | |
| RUN bundle install | |
| RUN echo here | |
| COPY . . | |
| RUN bundle exec jekyll build | |
| #Copy _sites from build to Nginx Container to serve site | |
| USER root | |
| FROM nginx:latest | |
| RUN mkdir -p /var/cache/nginx \ | |
| /var/log/nginx \ | |
| /var/lib/nginx \ | |
| /usr/share/nginx/html | |
| RUN touch /var/run/nginx.pid | |
| RUN groupadd user | |
| RUN useradd -d /home/user -ms /bin/bash -g user -G user -p user user | |
| RUN chown -R user:user /var/cache/nginx \ | |
| /var/log/nginx \ | |
| /var/lib/nginx \ | |
| /var/run/nginx.pid \ | |
| /usr/share/nginx/html | |
| #--- update nginx config; establish routes/proxy pass; remove user directive | |
| COPY ./nginx/etc.nginx.confd_default.conf /etc/nginx/conf.d/default.conf | |
| COPY ./nginx/etc.nginx_nginx.conf /etc/nginx/nginx.conf | |
| COPY --from=builder /usr/src/app/_site /usr/share/nginx/html | |
| COPY --chown=user ./_env_config/stg_dev/utl_dkr_preRun.sh ./scripts/docker/ | |
| RUN chmod +x ./scripts/docker/utl_dkr_preRun.sh | |
| USER user | |
| EXPOSE 7860 | |
| ENTRYPOINT [ "./scripts/docker/utl_dkr_preRun.sh" ] | |
| # CMD ["nginx", "-g", "daemon off;"] |