代码拉取完成,页面将自动刷新
FROM alpine:3.8 as build-env
WORKDIR /site
#build env
ENV ASCIIDOCTOR_VERSION=2.0.10
ENV HUGO_VERSION=0.77.0
ENV HUGO_DOWNLOAD_URL=https://github.com/spf13/hugo/releases/download/v${HUGO_VERSION}/hugo_${HUGO_VERSION}_Linux-64bit.tar.gz
RUN apk add --update --no-cache --virtual build-dependencies
# install some build prereqs
RUN apk add --update --no-cache \
bash \
build-base \
ca-certificates \
curl \
git \
libcurl \
libxml2-dev \
libxslt-dev \
openssh \
rsync \
ruby \
ruby-dev \
wget
# install gems
RUN gem install \
asciidoctor:${ASCIIDOCTOR_VERSION} \
html-proofer \
nokogiri \
--no-document && \
apk del build-dependencies
# download and install hugo
RUN wget "$HUGO_DOWNLOAD_URL" && \
tar xzf hugo_${HUGO_VERSION}_Linux-64bit.tar.gz && \
mv hugo /usr/bin/hugo && \
rm hugo_${HUGO_VERSION}_Linux-64bit.tar.gz LICENSE README.md || true
#copy the entire website folder into the build environment container
COPY . ./
#actually build the site
RUN hugo
# lets create the actual deployment image
FROM nginx:alpine
#copy over the site config for nginx
COPY ./.docker/default.conf /etc/nginx/conf.d/default.conf
#copy over the built website from the build environment docker
COPY --from=build-env /site/public /usr/share/nginx/html
# change permissions to allow running as arbitrary user
RUN chmod -R 777 /var/log/nginx /var/cache/nginx /var/run \
&& chgrp -R 0 /etc/nginx \
&& chmod -R g+rwX /etc/nginx
# use a different user as open shift wants non-root containers
# do it at the end here as it'll block our "root" commands to set the container up
USER 1000
#expose 8081 as we cant use port 80 on openshift (non-root restriction)
EXPOSE 8081
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。