forked from BaoXuebin/beancount-gs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdockerfile
52 lines (33 loc) · 1.21 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
ARG BEANCOUNT_VERSION=2.3.5
ARG GOLANG_VERSION=1.17.3
FROM golang:${GOLANG_VERSION} AS go_build_env
ENV GO111MODULE=on \
GOPROXY=https://goproxy.cn,direct \
GIN_MODE=release \
CGO_ENABLED=0 \
PORT=80
WORKDIR /tmp/build
RUN git clone https://github.com/BaoXuebin/beancount-gs.git
WORKDIR /tmp/build/beancount-gs
RUN mkdir -p public/default_icons && cp -rn public/icons/* public/default_icons
RUN go build .
FROM python:latest as build_env
ARG BEANCOUNT_VERSION
ENV PATH "/app/bin:$PATH"
RUN python3 -mvenv /app
WORKDIR /tmp/build
RUN git clone https://github.com/beancount/beancount
WORKDIR /tmp/build/beancount
RUN git checkout ${BEANCOUNT_VERSION}
RUN CFLAGS=-s pip3 install -U /tmp/build/beancount
RUN pip3 uninstall -y pip
RUN find /app -name __pycache__ -exec rm -rf -v {} +
FROM python:3.10-alpine
COPY --from=build_env /app /app
WORKDIR /app
COPY --from=go_build_env /tmp/build/beancount-gs /app
# volumes 挂载目录会导 /app/public/icons 中的图标被覆盖,这里将默认图标在挂载后重新拷贝图标
RUN cp -rn /app/public/default_icons/* /app/public/icons
ENV PATH "/app/bin:$PATH"
EXPOSE 80
CMD ["/app/beancount-gs", "-p", "80"]