This repository was archived by the owner on Feb 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathDockerfile
More file actions
58 lines (47 loc) · 1.82 KB
/
Dockerfile
File metadata and controls
58 lines (47 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
FROM idiswy/node:0.4
LABEL authors="WangYan <i@wangyan.org>"
# Setup Nginx
RUN set -xe && \
apt-get update && \
apt-get upgrade -y && \
apt-get install -y curl wget unzip git net-tools ca-certificates --no-install-recommends && \
curl -O "http://nginx.org/keys/nginx_signing.key" && \
apt-key add nginx_signing.key && \
rm -f nginx_signing.key && \
echo "deb http://nginx.org/packages/ubuntu/ xenial nginx" >> /etc/apt/sources.list && \
echo "deb-src http://nginx.org/packages/ubuntu/ xenial nginx" >> /etc/apt/sources.list && \
apt-get update && \
apt-get install --no-install-recommends --no-install-suggests -y ca-certificates nginx && \
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak && \
mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak
COPY nginx/nginx.conf /etc/nginx/nginx.conf
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
COPY nginx/hexo.conf /etc/nginx/conf.d/hexo.conf
# Nginx Runit
RUN mkdir -p /etc/service/nginx && \
echo '#!/bin/sh' >> /etc/service/nginx/run && \
echo 'exec 2>&1' >> /etc/service/nginx/run && \
echo 'exec nginx -g "daemon off;"' >> /etc/service/nginx/run && \
chmod +x /etc/service/nginx/run
# Yarn upgrade
RUN set -xe && \
apt-get install -y --only-upgrade yarn && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Setup Hexo
RUN set -xe && \
yarn global add hexo-cli && \
yarn global add pm2 && \
mkdir -p /opt/hexo /var/lib/hexo && \
cd /opt/hexo && \
hexo init . && \
yarn install
WORKDIR /opt/hexo
COPY ./deploy/index.js /var/lib/hexo/index.js
COPY ./deploy/deploy.sh /var/lib/hexo/deploy.sh
COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /etc/service/nginx/run /var/lib/hexo/deploy.sh /entrypoint.sh
# Expose Ports
EXPOSE 80
ENTRYPOINT ["/entrypoint.sh"]
CMD ["/sbin/my_init"]