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 4ff9c78..e8d9ef5 100644 Binary files a/database/development.sqlite3-shm and b/database/development.sqlite3-shm differ diff --git a/database/development.sqlite3-wal b/database/development.sqlite3-wal index 0e8f5e5..e19f5ca 100644 Binary files a/database/development.sqlite3-wal and b/database/development.sqlite3-wal differ 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