chore: reduce the docker images.

This commit is contained in:
Yufan Sheng 2024-06-20 22:49:23 +08:00
parent c8bc627869
commit d24dac2485
Signed by: syhily
GPG Key ID: 9D18A22A7DCD5A9B

View File

@ -4,6 +4,7 @@ import type { AstroIntegration, AstroIntegrationLogger } from 'astro';
import { z } from 'astro/zod'; import { z } from 'astro/zod';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
import { rimrafSync } from 'rimraf';
const S3Options = z.object({ const S3Options = z.object({
paths: z.array(z.string()).min(1), paths: z.array(z.string()).min(1),
@ -54,6 +55,7 @@ export const uploader = (opts: z.input<typeof S3Options>): AstroIntegration => (
for (const current of paths) { for (const current of paths) {
await uploadFile(client, logger, bucket, current, dir.pathname); await uploadFile(client, logger, bucket, current, dir.pathname);
rimrafSync(path.join(dir.pathname, current));
} }
logger.info('Upload all the files successfully.'); logger.info('Upload all the files successfully.');