-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
70 lines (55 loc) · 1.92 KB
/
.gitlab-ci.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
image: ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/docker:latest
stages:
- build
- deploy
services:
- docker:dind
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
DOCKER_HOST: tcp://docker:2375
DOCKER_IMAGE: ebispot/eqtl-sumstats-service
before_script:
- apk add --no-cache docker-compose
build:
stage: build
script:
# Enable BuildKit for advanced build features
- export DOCKER_BUILDKIT=1
- export COMPOSE_DOCKER_CLI_BUILD=1
# Login to Docker Hub
- echo "$DOCKER_HUB_PASSWORD" | docker login -u "$DOCKER_HUB_USER" --password-stdin
# Pull the latest image to use as a cache source
- docker pull $DOCKER_IMAGE:latest || true # Ignore if the image doesn't exist yet
# Build the image using docker-compose with cache
- docker-compose build
# Tag the built image with both latest and CI_COMMIT_SHA
- docker tag $DOCKER_IMAGE $DOCKER_IMAGE:latest
- docker tag $DOCKER_IMAGE $DOCKER_IMAGE:$CI_COMMIT_SHA
# Push both the SHA-tagged and latest images
- docker push $DOCKER_IMAGE:$CI_COMMIT_SHA
- docker push $DOCKER_IMAGE:latest
only:
- master
- dev
# Deploy the application using Singularity and Slurm
deploy_staging:
image: alpine
stage: deploy
before_script:
- apk add openssh-client
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
script:
# # Copy the deployment script to the HPC
# TODO: fix
# - scp ./deployment/START_EQTL_INGEST.sh $WORKER_USER@$WORKER_SERVER_SLURM:$WORKER_DIR_DEV
# SSH into the HPC and run the deployment script
- ssh -o StrictHostKeyChecking=no "$WORKER_USER"@"$WORKER_SERVER_SLURM" "sbatch --job-name=eqtl-etl --mem=12000M --time=7-00:00:00 --partition=datamover -D $WORKER_DIR_DEV -o eqtl_deploy.out -e eqtl_deploy.err --wrap='./START_EQTL_INGEST.sh $CI_COMMIT_SHA'"
tags:
- gwas
only:
- master
- dev