Dockerfile 构建 Hexo 并上传对象存储

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
FROM node:18.13 as build

WORKDIR /code

COPY . .

RUN sed -i "s+future: true+future: false+" _config.yml && \
npm i --no-progress && \
npm i hexo-cli -g && \
hexo g -f -s

FROM ghcr.io/hongfs/env:aws-cli as upload

ENV AWS_ACCESS_KEY_ID=LTAI5tBE2LZ12gMMzK8
ENV AWS_SECRET_ACCESS_KEY=4v35wJa71zW4diMJuH6Pxy1ZExaSFm
ENV AWS_EC2_METADATA_DISABLED=true

WORKDIR /web

COPY --from=build /code/public /web/

RUN /usr/local/bin/aws configure set default.s3.addressing_style virtual && \
/usr/local/bin/aws configure set default.s3.max_concurrent_requests 100 && \
/usr/local/bin/aws s3 sync /web s3://hongfs-blog --no-progress --follow-symlinks --delete --quiet --endpoint-url=https://oss-cn-shenzhen.aliyuncs.com
往上