Dockerized backend & added pipeline

This commit is contained in:
2022-05-10 01:37:18 +03:00
parent 4023b3fec8
commit 7e93d9374b
3 changed files with 63 additions and 6 deletions

56
.drone.yml Normal file
View File

@@ -0,0 +1,56 @@
kind: pipeline
type: docker
name: frontend
clone:
disable: true
steps:
- name: bulid
image: node:16
environment:
SSH_KEY:
from_secret: SSH_KEY
commands:
- git clone https://git.radner.ru/anatolykopyl/worktime.git
- cd worktime
- npm install
- npm run build
- mkdir ~/.ssh
- echo "$SSH_KEY" > ~/.ssh/id_rsa
- chmod 400 ~/.ssh/id_rsa
- scp -o StrictHostKeyChecking=no -r dist/* webmaster@worktime.anatolykopyl.ru:~/www/worktime.anatolykopyl.ru
when:
branch:
- cloud-saves
---
kind: pipeline
type: ssh
name: backend
server:
host: worktime.anatolykopyl.ru
user: webmaster
ssh_key:
from_secret: SSH_KEY
clone:
disable: true
steps:
- name: fetch remote
commands:
- cd /home/webmaster/worktime && git fetch --all && git reset --hard origin/cloud-saves
- name: build docker
commands:
- docker build --tag worktime:latest /home/worktime/backend
- name: restart docker
- docker stop worktime
- docker rm worktime
- docker run --name worktime -p 3003:3000 -d worktime
trigger:
branch:
- cloud-saves

7
backend/Dockerfile Normal file
View File

@@ -0,0 +1,7 @@
FROM denoland/deno:1.21.2
EXPOSE 3000
WORKDIR /app
USER deno
COPY . .
RUN deno cache ./src/index.ts
CMD ["run", "--allow-all", "./src/index.ts"]

6
package-lock.json generated
View File

@@ -1,6 +0,0 @@
{
"name": "worktime",
"lockfileVersion": 2,
"requires": true,
"packages": {}
}