add: 新增 .editconfig 统一编辑器配置,更新 Dockerfile 使用 Python 3.12 和 Beancount 3.2.0

This commit is contained in:
cnb.asek4HHRAKA 2025-10-01 19:43:35 +08:00
parent 0ef1dca044
commit f134416d4a
2 changed files with 95 additions and 6 deletions

89
.editconfig Normal file
View File

@ -0,0 +1,89 @@
# EditorConfig is awesome: https://EditorConfig.org
# 这是顶级文件
root = true
# 所有文件的默认设置
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
# Markdown 文件特定设置
[*.md]
max_line_length = off
trim_trailing_whitespace = false
# YAML 文件特定设置
[*.{yml,yaml}]
indent_size = 2
# JSON 文件特定设置
[*.json]
indent_size = 2
# Python 文件特定设置
[*.py]
indent_size = 4
max_line_length = 88
# JavaScript/TypeScript 文件特定设置
[*.{js,jsx,ts,tsx}]
indent_size = 2
max_line_length = 100
# CSS/SCSS 文件特定设置
[*.{css,scss}]
indent_size = 2
# HTML 文件特定设置
[*.html]
indent_size = 2
# Shell 脚本特定设置
[*.sh]
indent_size = 2
# XML 文件特定设置
[*.xml]
indent_size = 2
# Makefile 特定设置
[Makefile]
indent_style = tab
# Go 文件特定设置
[*.go]
indent_style = tab
indent_size = 4
# Java 文件特定设置
[*.java]
indent_size = 4
# C/C++ 文件特定设置
[*.{c,cpp,h,hpp}]
indent_size = 4
# PHP 文件特定设置
[*.php]
indent_size = 4
# Ruby 文件特定设置
[*.rb]
indent_size = 2
# SQL 文件特定设置
[*.sql]
indent_size = 2
# Dockerfile 特定设置
[Dockerfile]
indent_size = 4
# Vue 文件特定设置
[*.vue]
indent_size = 2

View File

@ -1,5 +1,5 @@
# 第一阶段:构建阶段 # 第一阶段:构建阶段 python:3.12-alpine3.22
FROM python:3.11.9-alpine3.19 as builder FROM python:3.12-alpine3.22 as builder
# 设置环境变量,防止 Python 创建 .pyc 文件 # 设置环境变量,防止 Python 创建 .pyc 文件
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1
@ -20,21 +20,21 @@ WORKDIR /app
RUN python3 -m venv /app/venv RUN python3 -m venv /app/venv
# 将 Beancount 源码压缩包复制到容器中 # 将 Beancount 源码压缩包复制到容器中
COPY beancount-2.3.6.tar.gz /app COPY beancount-3.2.0.tar.gz /app
# 解压 Beancount 源码到 /beancount 目录 # 解压 Beancount 源码到 /beancount 目录
RUN mkdir /beancount && \ RUN mkdir /beancount && \
tar -xzf /app/beancount-2.3.6.tar.gz -C /beancount --strip-components=1 tar -xzf /app/beancount-3.2.0.tar.gz -C /beancount --strip-components=1
# 激活虚拟环境并安装 Beancount # 激活虚拟环境并安装 Beancount
RUN /app/venv/bin/pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/ && \ RUN /app/venv/bin/pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple/ && \
/app/venv/bin/pip install /beancount -i https://mirrors.aliyun.com/pypi/simple/ && \ /app/venv/bin/pip install /beancount -i https://mirrors.aliyun.com/pypi/simple/ && \
# 清理不必要的文件 # 清理不必要的文件
rm -rf /app/beancount-2.3.6.tar.gz && \ rm -rf /app/beancount-3.2.0.tar.gz && \
find /app -name __pycache__ -exec rm -rf -v {} + find /app -name __pycache__ -exec rm -rf -v {} +
# 第二阶段:运行阶段 # 第二阶段:运行阶段
FROM python:3.11.9-alpine3.19 FROM python:3.12-alpine3.22
# 设置环境变量,防止 Python 创建 .pyc 文件 # 设置环境变量,防止 Python 创建 .pyc 文件
ENV PYTHONUNBUFFERED=1 ENV PYTHONUNBUFFERED=1