Skip to content

Instantly share code, notes, and snippets.

@masutaka
Created January 19, 2019 07:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masutaka/193483b54bfd4873c82c24a013a98740 to your computer and use it in GitHub Desktop.
Save masutaka/193483b54bfd4873c82c24a013a98740 to your computer and use it in GitHub Desktop.
masutaka.net on Heroku Docker
# (1) Perl の chalow コマンドで CHANGELOG メモを静的ファイルに変換
FROM perl:5.28.0 AS chalow
RUN cpanm CGI HTML::Template
WORKDIR /work
COPY chalow/ chalow
COPY script/ script
COPY webroot/ webroot
RUN ./script/mkchalow
# (2) Honoka の css を取得
FROM node:10.14.2-alpine AS honoka
RUN apk add --update --no-cache jq=1.6_rc1-r1
WORKDIR /work
COPY package.json .
COPY package-lock.json .
RUN npm install
RUN HONOKA_VERSION=$(jq -r '.dependencies."bootstrap-honoka".version' < package-lock.json) && \
mkdir -p "webroot/honoka/${HONOKA_VERSION}/css" && \
cp node_modules/bootstrap-honoka/dist/css/bootstrap.min.css "webroot/honoka/${HONOKA_VERSION}/css"
# (3) (1) と (2) のビルド生成物を nginx コンテナにコピー
FROM nginx:1.15.7-alpine
COPY --from=chalow /work/webroot /usr/share/nginx/html
COPY --from=honoka /work/webroot/honoka /usr/share/nginx/html/honoka
CMD sed -i -e "s/^\( \+listen \+\)80;/\1$PORT;/" /etc/nginx/conf.d/default.conf && \
nginx -g "daemon off;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment