-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
61 lines (45 loc) · 1.59 KB
/
Dockerfile
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
59
60
61
# Copyright 2023 daz-3ux(杨鹏达) <[email protected]>. All rights reserved.
# Use of this source code is governed by a MIT style
# license that can be found in the LICENSE file. The original repo for
# this file is https://github.com/Daz-3ux/dBlog.
FROM archlinux/archlinux:base-devel AS base
LABEL maintainer="<[email protected]>"
ENV GO111MODULE=on \
GOPROXY=https://goproxy.cn,direct \
DB_HOST=<127.0.0.1> \
DB_PORT=<3306> \
DB_USER=<root> \
DB_PASSWORD=<passwd> \
DB_NAME=<dazBlog>
ENV TZ Asia/Shanghai
RUN echo "Server = https://mirrors.bfsu.edu.cn/archlinux/\$repo/os/\$arch" | tee /etc/pacman.d/mirrorlist && \
pacman -Syyu --noconfirm && \
pacman -S --noconfirm go && \
pacman -Scc --noconfirm
FROM base AS build
WORKDIR /dBlog
COPY . .
RUN make tools.verify && \
make ca && \
make && \
chmod +r /dBlog/internal/resource/404.html && \
chmod +x /dBlog/_output/platforms/linux/amd64/dBlog
FROM ubuntu:devel AS final
WORKDIR /dBlog
RUN mkdir -p /var/log/dazblog &&\
mkdir -p /etc/ssl/certs/ &&\
touch /var/log/dazblog/dazblog.log && \
apt-get update && \
apt-get install curl -y
COPY --from=build \
/dBlog/_output/platforms/linux/amd64/dBlog \
/dBlog/_output/platforms/linux/amd64/dBlog \
/dBlog/_output/cert/ \
/dBlog/_output/cert/ \
/dBlog/internal/resource/404.html \
/dBlog/internal/resource/ \
/dBlog/configs/dazBlog.yaml \
/dBlog/configs/
HEALTHCHECK CMD curl --fail http://localhost:8081/healthz || exit 1
ENTRYPOINT ["_output/platforms/linux/amd64/dBlog"]
CMD ["-c", "configs/dazBlog.yaml"]