add rebuild api
This commit is contained in:
parent
33f498af70
commit
51bc604cda
3 changed files with 6 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
|||
FROM node:lts-alpine AS base
|
||||
RUN npm i -g pnpm && \
|
||||
RUN npm i -g pnpm nodemon && \
|
||||
apk add git
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
@ -8,4 +8,4 @@ RUN pnpm install && pnpm build
|
|||
ENV HOST=0.0.0.0
|
||||
ENV PORT=4321
|
||||
EXPOSE 4321
|
||||
CMD node ./dist/server/entry.mjs
|
||||
CMD nodemon --delay 10s ./dist/server/entry.mjs
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
},
|
||||
"scripts": {
|
||||
"dev": "astro dev",
|
||||
"start": "astro dev",
|
||||
"build": "astro build",
|
||||
"preview": "astro preview",
|
||||
"astro": "astro",
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
export const prerender = false;
|
||||
import { exec } from "node:child_process";
|
||||
import util from "node:util";
|
||||
import type { APIRoute } from "astro";
|
||||
const exec_promise = util.promisify(exec);
|
||||
export async function POST({ params, request }) {
|
||||
export const POST: APIRoute = async ({ params, request }) => {
|
||||
console.log(params, request);
|
||||
let result = await exec_promise("git pull && pnpm build").then((out, err) => {
|
||||
return { out, err };
|
||||
});
|
||||
console.log("Outside", result);
|
||||
return new Response(JSON.stringify(result));
|
||||
}
|
||||
};
|
Loading…
Add table
Reference in a new issue