Dockerfile 构建 Hexo 并上传对象存储

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
FROM ghcr.io/hongfs/env:hexo-cli as build

WORKDIR /code

COPY . .

RUN sed -i "s+future: true+future: false+" _config.yml && \
npm i --no-progress && \
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

WORKDIR /web

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

RUN aws s3 sync /web s3://hongfs-blog --no-progress --follow-symlinks --delete --quiet --endpoint-url=https://oss-cn-shenzhen.aliyuncs.com
往上