Skip to content

Commit

Permalink
修改dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Jerry committed Aug 1, 2024
1 parent 5346e93 commit 2f2b55b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ COPY front/package*.json ./
RUN npm install
COPY front/. .
RUN npm run generate
RUN chmod +x /app/replace_underscore.sh
RUN /app/replace_underscore.sh
RUN ls -l /app/.output/public

FROM golang:1.22.5-alpine as backend
ENV CGO_ENABLED 1
Expand Down
16 changes: 16 additions & 0 deletions front/replace_underscore.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

TARGET_DIR="/app/.output/public"
# 遍历当前目录及子目录中的所有以 _ 开头的文件
find "$TARGET_DIR" -type f -name '_*' | while read -r file; do
# 获取文件的目录和新文件名
dir=$(dirname "$file")
new_file="${file/_/a}"

# 重命名文件
mv "$file" "$new_file"

# 更新所有引用到这个文件的地方
# 使用 sed 替换文件内容中的引用
find "$dir" -type f -exec sed -i "s|$file|$new_file|g" {} +
done

0 comments on commit 2f2b55b

Please sign in to comment.