From be66f02546ad818c0846e35e70d6d717141ece2b Mon Sep 17 00:00:00 2001 From: dash <1549469775@qq.com> Date: Tue, 2 Sep 2025 23:38:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DDockerfile=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 6 ++++-- database/development.sqlite3-shm | Bin 32768 -> 32768 bytes database/development.sqlite3-wal | Bin 646872 -> 675712 bytes src/middlewares/install.js | 8 ++++---- src/views/page/profile/index.pug | 3 +++ 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 97103e9..0a14df1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,14 +10,14 @@ RUN apk add --no-cache python3 make g++ gcc dos2unix COPY --chown=bun:bun ./package.json ./package.json COPY --chown=bun:bun ./bun.lockb ./bun.lockb COPY --chown=bun:bun ./knexfile.mjs ./knexfile.mjs -COPY --chown=bun:bun ./.env.production ./.env.production COPY --chown=bun:bun ./jsconfig.json ./jsconfig.json COPY --chown=bun:bun ./src ./src COPY --chown=bun:bun ./public ./public COPY --chown=bun:bun ./entrypoint.sh ./entrypoint.sh # 安装生产依赖和修复 entrypoint.sh -RUN bun install --frozen-lockfile --production --registry https://registry.npmjs.org && \ +# RUN bun install --frozen-lockfile --production --registry https://registry.npmjs.org && \ +RUN bun install --frozen-lockfile --production && \ # 修复 entrypoint.sh 的换行符 dos2unix ./entrypoint.sh && \ chmod +x ./entrypoint.sh @@ -46,3 +46,5 @@ HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \ # 设置入口点 ENTRYPOINT ["./entrypoint.sh"] + +# docker build -t koa3-demo . \ No newline at end of file diff --git a/database/development.sqlite3-shm b/database/development.sqlite3-shm index 4ff9c78490ec8d3004e4af5385bd5b6f25caaf5f..e8d9ef559001896f529ae0a9a0fba79b9f91002a 100644 GIT binary patch delta 220 zcmZo@U}|V!s+V}A%K!o_K+MR%Ag}~T3jy&o_Oq2K>Bl|p|B#;l=KTS6*Q%+B5$WsZ zld2wQ6c~Wa{f`8o!b}YFH#Sx?NeTk_Ak2z}*)}sWzqH@{&qG^NoA5br@68~ta zvfgfc!4;+s=IswIa6Dz%ezunRF4Od%k{q(z`FC;7VVS;LgqfFPg0l0T7U`2aAxftM zmGW;l|H0(LyxsZ=M;9ZSu9Ykt1;Tfgmdi4AY(KD%^DV!&g`v5Dsj-2%kzPSwdSY@( zW?3rGC9KGK7q}J3M_ovFPvmoW)y7nV&P|y)Nf=JWneHi7G$WLu6K{K zAta-uq@dVJU%xytC#NVsKUXg^Uq3T9UEk2s$e_Z|z`{VkB%?GpNk1uFH`O%N+}t2l aFRK9IO*Uk2R-R>_=5ahdW%-18oB{x58k#%+ delta 27 icmZpeuX$sydP56i3sVbo3rh=Y3tJ0&3&$4D8}|T_ObR>z diff --git a/src/middlewares/install.js b/src/middlewares/install.js index 80eac7a..37c635b 100644 --- a/src/middlewares/install.js +++ b/src/middlewares/install.js @@ -8,8 +8,8 @@ import { Auth } from "./Auth" import bodyParser from "koa-bodyparser" import Views from "./Views" import Session from "./Session" -import etag from "@koa/etag" -import conditional from "koa-conditional-get" +import etag from "@koa/etag" +import conditional from "koa-conditional-get" import { autoRegisterControllers } from "@/utils/ForRegister.js" const __dirname = path.dirname(fileURLToPath(import.meta.url)) @@ -21,7 +21,7 @@ export default app => { // 响应时间 app.use(ResponseTime) // session设置 - app.use(Session(app)); + app.use(Session(app)) // 权限设置 app.use( Auth({ @@ -44,7 +44,7 @@ export default app => { extension: "pug", options: { basedir: resolve(__dirname, "../views"), - } + }, }) ) // 请求体解析 diff --git a/src/views/page/profile/index.pug b/src/views/page/profile/index.pug index 33fd665..f0fc9d0 100644 --- a/src/views/page/profile/index.pug +++ b/src/views/page/profile/index.pug @@ -459,6 +459,9 @@ block pageHead } block pageContent + form(action="/profile/upload-avatar" method="post" enctype="multipart/form-data") + input(type="file", name="avatar", accept="image/*" onchange="document.getElementById('upload-btn').click()") + button#upload-btn(type="submit") 上传头像 .profile-container .profile-sidebar .profile-avatar