⬇️ Update dockerfile

降级beancount至2.3.6,以支持`bean-report` `bean-query` `bean-check`
This commit is contained in:
quewen08 2024-07-06 11:19:58 +08:00 committed by 初意
parent aaee9bcf73
commit 94ac302767
1 changed files with 35 additions and 16 deletions

View File

@ -1,11 +1,27 @@
# 构建beancount2.3.6
FROM python:3.11.9-alpine3.19 as beancount_builder
WORKDIR /build
RUN echo "https://mirrors.aliyun.com/alpine/v3.16/main/" > /etc/apk/repositories \
&& echo "https://mirrors.aliyun.com/alpine/v3.16/community/" >> /etc/apk/repositories \
&& set -x \
&& apk add --no-cache gcc musl-dev \
&& python3 -mvenv /app \
&& wget https://github.com/beancount/beancount/archive/refs/tags/2.3.6.tar.gz \
&& tar -zxvf 2.3.6.tar.gz \
&& /app/bin/pip install ./beancount-2.3.6 -i https://mirrors.aliyun.com/pypi/simple/ \
&& find /app -name __pycache__ -exec rm -rf -v {} + \
&& apk del gcc musl-dev
# 构建 beancount-gs # 构建 beancount-gs
FROM golang:1.17.3-alpine AS go_builder FROM golang:1.17.3-alpine AS go_builder
ENV GO111MODULE=on \ ENV GO111MODULE=on \
GOPROXY=https://goproxy.cn,direct \ GOPROXY=https://goproxy.cn,direct \
GIN_MODE=release \ GIN_MODE=release \
CGO_ENABLED=0 \ CGO_ENABLED=0 \
PORT=80 PORT=80
WORKDIR /build WORKDIR /build
COPY . . COPY . .
@ -17,14 +33,17 @@ FROM python:3.11.9-alpine3.19
WORKDIR /app WORKDIR /app
RUN echo "https://mirrors.aliyun.com/alpine/v3.16/main/" > /etc/apk/repositories \ #RUN echo "https://mirrors.aliyun.com/alpine/v3.16/main/" > /etc/apk/repositories \
&& echo "https://mirrors.aliyun.com/alpine/v3.16/community/" >> /etc/apk/repositories \ # && echo "https://mirrors.aliyun.com/alpine/v3.16/community/" >> /etc/apk/repositories \
&& set -x \ # && set -x \
&& apk update \ # && apk update \
&& apk add --no-cache gcc musl-dev \ # && apk add --no-cache gcc musl-dev \
&& python3 -mvenv /app/beancount \ # && python3 -mvenv /app/beancount \
&& /app/beancount/bin/pip install --no-cache-dir beanquery -i https://mirrors.aliyun.com/pypi/simple/ \ # && /app/beancount/bin/pip install --no-cache-dir beancount==2.3.6 -i https://mirrors.aliyun.com/pypi/simple/ \
&& apk del gcc musl-dev # && apk del gcc musl-dev
# 大概116M的文件
COPY --from=beancount_builder /app /app/beancount
COPY --from=go_builder /build/beancount-gs /app COPY --from=go_builder /build/beancount-gs /app
COPY --from=go_builder /build/template /app/template COPY --from=go_builder /build/template /app/template
@ -33,9 +52,9 @@ COPY --from=go_builder /build/public /app/public
COPY --from=go_builder /build/logs /app/logs COPY --from=go_builder /build/logs /app/logs
ENV LANG=C.UTF-8 \ ENV LANG=C.UTF-8 \
SHELL=/bin/bash \ SHELL=/bin/bash \
PS1="\u@\h:\w \$ " \ PS1="\u@\h:\w \$ " \
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/app/bin:/app/beancount/bin" PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/app/bin:/app/beancount/bin"
EXPOSE 80 EXPOSE 80