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