加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Dockerfile 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
Marek Roszko 提交于 2021-01-02 00:53 . Throw in ci/docker
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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化