mirror of
https://github.com/Myzel394/amiopen.now.git
synced 2025-06-18 15:35:27 +02:00
feat(ci-cd): Add auto release
This commit is contained in:
parent
346b14bd53
commit
a37a47f5d1
22
.github/workflows/release.yaml
vendored
Normal file
22
.github/workflows/release.yaml
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
name: Build and release
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Add SSH identity key
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
||||||
|
chmod 600 ~/.ssh/id_rsa
|
||||||
|
ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
|
- name: Build & upload image
|
||||||
|
run: ./upload_to_server.sh ${{ secrets.SERVER_IP }} ${{ secrets.SSH_USER }}
|
||||||
|
|
15
Dockerfile
Normal file
15
Dockerfile
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
FROM oven/bun:alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY entrypoint.sh ./
|
||||||
|
COPY package.json ./
|
||||||
|
COPY bun.lockb ./
|
||||||
|
COPY src ./src
|
||||||
|
|
||||||
|
RUN bun install
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
ENTRYPOINT ["bun", "run", "start"]
|
||||||
|
|
9
upload_to_server.sh
Executable file
9
upload_to_server.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
ip=$1
|
||||||
|
user=$2
|
||||||
|
|
||||||
|
docker buildx build --platform linux/amd64 . --tag amiopen:latest
|
||||||
|
docker save -o amiopen.tar amiopen:latest
|
||||||
|
|
||||||
|
scp amiopen.tar $user@$ip:~/amiopen/amiopen.tar
|
||||||
|
ssh $user@$ip "cd ~/amiopen && docker container stop amiopen && docker container rm amiopen && docker load -i amiopen.tar && docker compose up -d"
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user