Compare commits

..

6 Commits

4 changed files with 9 additions and 5 deletions

3
.gitignore vendored
View File

@ -1,6 +1,9 @@
node_modules node_modules
postgres postgres
key
key.pub
# Output # Output
.output .output
.vercel .vercel

@ -1 +0,0 @@
Subproject commit 1af78edd4c4e4e5b3834303e19f3507998019825

View File

@ -15,11 +15,13 @@ RUN npm run build
# For Run # For Run
FROM node:22-slim FROM node:22-slim
RUN apt-get update && apt-get install -y git
WORKDIR /app WORKDIR /app
COPY ./articles ./articles COPY ./key ./key
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* && \
mkdir -p ~/.ssh && \
ssh-keyscan -t rsa gitea.hareworks.net >> ~/.ssh/known_hosts && \
git -c core.sshCommand="ssh -i ./key -F /dev/null" clone git@gitea.hareworks.net:Hare/blog-articles.git articles
COPY --from=builder /app/build ./build COPY --from=builder /app/build ./build
COPY --from=builder /app/package.json . COPY --from=builder /app/package.json .

View File

@ -7,7 +7,7 @@ import { execSync } from 'child_process';
export default async function init(db: Postgres) { export default async function init(db: Postgres) {
if (fs.existsSync('./articles/')) { if (fs.existsSync('./articles/')) {
console.log('Pulling articles from git..'); console.log('Pulling articles from git..');
const stdout = execSync('git pull', { cwd: './articles/' }); const stdout = execSync('git -c core.sshCommand="ssh -i ../key -F /dev/null" pull', { cwd: './articles/' });
console.log(stdout.toString()); console.log(stdout.toString());
} }