ci: add gitlab ci for docker compose
- split into multiple jobs - specify tags for runner large - use buildx and add separate builder default has no cache - build image from cache and push to registry - compose use tag and pull - use cache tag for reuse - https://github.com/moby/buildkit/issues/1981 - https://github.com/moby/buildkit/issues/3730 - use cache-to and cache-from with registry/cache - add dockerignore to prevent rebuild on git changes - use individual builders - add step for docker compose up - update readme - update dockerignore - add gitignore - use script reduce duplicate code - cache from and to in build, compose use cache - dont push images just use cache - build in compose step from cache Signed-off-by: Lakshya Singh <lakshay.singh1108@gmail.com>
This commit is contained in:
parent
e24d968f27
commit
e926f4aacc
9
.dockerignore
Normal file
9
.dockerignore
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
**/.dockerignore
|
||||||
|
**/.env
|
||||||
|
**/.git
|
||||||
|
**/.gitignore
|
||||||
|
**/docker-compose*
|
||||||
|
**/Dockerfile*
|
||||||
|
**/*.Dockerfile
|
||||||
|
LICENSE
|
||||||
|
README.md
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.env
|
57
.gitlab-ci.yml
Normal file
57
.gitlab-ci.yml
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
|
||||||
|
default:
|
||||||
|
image: docker:24.0.7
|
||||||
|
services:
|
||||||
|
- docker:24.0.7-dind
|
||||||
|
before_script:
|
||||||
|
- docker version
|
||||||
|
- docker compose version
|
||||||
|
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||||
|
|
||||||
|
variables:
|
||||||
|
VLS_CONTAINER_REGISTRY: $CI_REGISTRY/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME
|
||||||
|
CACHE: $CI_REGISTRY_IMAGE/cache
|
||||||
|
CACHE_TAG: $CI_COMMIT_REF_SLUG
|
||||||
|
IMAGE_TAG: $CI_COMMIT_SHA
|
||||||
|
|
||||||
|
build_bitcoin:
|
||||||
|
tags: [ saas-linux-large-amd64 ]
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- ./scripts/build_image_cache.sh bitcoind
|
||||||
|
build_core_lightning:
|
||||||
|
tags: [ saas-linux-large-amd64 ]
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- ./scripts/build_image_cache.sh lightningd
|
||||||
|
build_txoo:
|
||||||
|
tags: [ saas-linux-medium-amd64 ]
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- ./scripts/build_image_cache.sh txood
|
||||||
|
build_vls:
|
||||||
|
tags: [ saas-linux-large-amd64 ]
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- ./scripts/build_image_cache.sh vlsd
|
||||||
|
compose:
|
||||||
|
tags: [ saas-linux-medium-amd64 ]
|
||||||
|
stage: test
|
||||||
|
variables:
|
||||||
|
BUILDER: compose_builder
|
||||||
|
before_script:
|
||||||
|
- docker volume create bitcoin_data
|
||||||
|
- docker volume create lightning_data
|
||||||
|
- docker volume create txoo_data
|
||||||
|
- docker volume create vls_data
|
||||||
|
- docker buildx create --name=$BUILDER --use
|
||||||
|
script:
|
||||||
|
- echo "IMAGE_TAG=${IMAGE_TAG}" > .env
|
||||||
|
- ./scripts/build_from_cache.sh bitcoind
|
||||||
|
- ./scripts/build_from_cache.sh lightningd
|
||||||
|
- ./scripts/build_from_cache.sh txood
|
||||||
|
- ./scripts/build_from_cache.sh vlsd
|
||||||
|
- docker compose --profile vls up -d --wait --wait-timeout 120 --build
|
@ -187,7 +187,7 @@ docker container exec lightningd-test lightning-cli --testnet summary
|
|||||||
- [x] standalone docker image for `lightningd`
|
- [x] standalone docker image for `lightningd`
|
||||||
- [x] standalone docker image for `bitcoind`
|
- [x] standalone docker image for `bitcoind`
|
||||||
- [ ] supporting signet
|
- [ ] supporting signet
|
||||||
- [ ] Profile configuration to run `vls`
|
- [x] Profile configuration to run `vls`
|
||||||
- [ ] Healthcheck for `txoo`
|
- [ ] Healthcheck for `txoo`
|
||||||
- [ ] Healthcheck for `vls`
|
- [ ] Healthcheck for `vls`
|
||||||
- [ ] Lightning Storage Server Dockerfile and Compose Service
|
- [ ] Lightning Storage Server Dockerfile and Compose Service
|
||||||
|
8
scripts/build_from_cache.sh
Executable file
8
scripts/build_from_cache.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
SERVICE=$1
|
||||||
|
|
||||||
|
cd $SERVICE
|
||||||
|
docker build --load --builder $BUILDER --cache-from $CACHE/$SERVICE:$CACHE_TAG -t $SERVICE:$IMAGE_TAG .
|
10
scripts/build_image_cache.sh
Executable file
10
scripts/build_image_cache.sh
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
SERVICE=$1
|
||||||
|
|
||||||
|
docker buildx create --name=$SERVICE --use
|
||||||
|
cd $SERVICE
|
||||||
|
|
||||||
|
docker build --load --builder=$SERVICE --cache-to type=registry,ref=$CACHE/$SERVICE:$CACHE_TAG --cache-from $CACHE/$SERVICE:$CACHE_TAG -t $SERVICE:$IMAGE_TAG .
|
Loading…
x
Reference in New Issue
Block a user