25 lines
750 B
Text
25 lines
750 B
Text
VERSION 0.7
|
|
FROM node:lts
|
|
|
|
site:
|
|
RUN npm install -g pnpm
|
|
COPY package.json pnpm-lock.yaml /site
|
|
WORKDIR /site
|
|
CACHE $HOME/.local/share/pnpm
|
|
RUN pnpm install --frozen-lockfile
|
|
COPY . /site
|
|
RUN pnpm build
|
|
SAVE ARTIFACT build AS LOCAL build
|
|
|
|
deploy:
|
|
FROM alpine
|
|
RUN apk add openssh-client rsync
|
|
RUN --secret SSH_CONFIG --secret SSH_UPLOAD_KEY --secret SSH_KNOWN_HOSTS \
|
|
mkdir -p $HOME/.ssh && \
|
|
echo "$SSH_CONFIG" > $HOME/.ssh/config && \
|
|
echo "$SSH_UPLOAD_KEY" > $HOME/.ssh/id_rsa && \
|
|
echo "$SSH_KNOWN_HOSTS" > $HOME/.ssh/known_hosts && \
|
|
chmod 600 $HOME/.ssh/*
|
|
COPY +site/build /build
|
|
RUN --secret SSH_TARGET --push rsync -cvrz --delete /build/ $SSH_TARGET
|
|
|