-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbitbucket-pipelines.yml
35 lines (32 loc) · 1.11 KB
/
bitbucket-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
image: golang
pipelines:
default:
- step:
name: Test and Build
script:
- go mod download
- go run main.go
branches:
master:
- step:
services:
- docker
name: Deploy to Registry
script:
- export IMAGE_NAME=hanthamarats/tech-now-epay:$BITBUCKET_COMMIT
- docker build -t $IMAGE_NAME .
- docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD
- docker push $IMAGE_NAME
- step:
name: Deploy to droplet
script:
- export IMAGE_NAME=hanthamarats/tech-now-epay:$BITBUCKET_COMMIT
- pipe: atlassian/ssh-run:0.2.2
variables:
SSH_USER: $SSH_USER
SERVER: $SSH_SERVER
COMMAND: >
docker stop $CONTAINERS_TO_STOP
docker run -p $SERVER_PORT:$SERVER_PORT -e JWT_SECRET=$JWT_SECRET -e DB_HOST=$DB_HOST -e DB_PORT=$DB_PORT -e DB_USER=$DB_USER -e DB_PASSWORD=$DB_PASSWORD -e DB_NAME=$DB_NAME -e OmisePublicKey=$OmisePublicKey -e OmiseSecretKey=$OmiseSecretKey -d $IMAGE_NAME
services:
- docker