Skip to content

Instantly share code, notes, and snippets.

View bvis's full-sized avatar

Basi bvis

View GitHub Profile
@bvis
bvis / README.md
Last active August 9, 2024 18:34
Docker Env Vars expanded with secrets content

Variables by Secrets

Sample script that allows you to define as environment variables the name of the docker secret that contains the secret value. It will be in charge of analyze all the environment variables searching for the placeholder to substitute the variable value by the secret.

Usage

You can define the next environment variables:

@bvis
bvis / Jenkinsfile
Last active January 3, 2023 20:45
Jenkin pipeline definition example to be integrated with Docker Swarm cluster in our CI/CD environment
pipeline {
agent { node { label 'swarm-ci' } }
environment {
TEST_PREFIX = "test-IMAGE"
TEST_IMAGE = "${env.TEST_PREFIX}:${env.BUILD_NUMBER}"
TEST_CONTAINER = "${env.TEST_PREFIX}-${env.BUILD_NUMBER}"
REGISTRY_ADDRESS = "my.registry.address.com"
SLACK_CHANNEL = "#deployment-notifications"
@bvis
bvis / deploy.sh
Created September 5, 2017 11:44
Autoregister your swarm nodes in Portainer
# Create the password needed to login to portainer and reuse it for the portainer endpoints.
export VOLUME_DRIVER=local
export PORTAINER_PASS=mySuperSECRETPass
export PORTAINER_ENC_PASS=$(docker run --rm httpd:2.4-alpine htpasswd -nbB admin ${PORTAINER_PASS} | cut -d ":" -f 2)
echo $PORTAINER_PASS | docker secret create portainer_password.v1 --label portainer -
# Deploy the stack!
docker stack deploy --compose-file docker-compose.yml portainer