Created
February 16, 2016 01:16
-
-
Save tinoadams/eb93f1abcd5a21e6650e to your computer and use it in GitHub Desktop.
Run the latest JFrog Artifactory registry inside a Docker container with recommended volumes mounted to the hosts current directory and an initial copy of the default Artifactory configs extracted form the Artifactory image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -e | |
export ARTIFACTORY_IMAGE='jfrog-docker-reg2.bintray.io/jfrog/artifactory-registry:latest' | |
export ARTIFACTORY_CONTAINER_NAME='art' | |
export ARTIFACTORY_HOST_HOME="$PWD" | |
export ARTIFACTORY_HOME=/var/opt/jfrog/artifactory | |
echo "Artifactory home directory on the host: $ARTIFACTORY_HOST_HOME" | |
docker rm -f $ARTIFACTORY_CONTAINER_NAME &> /dev/null || echo "no previous Artifactory container not running... moving along" | |
if [ ! -d $ARTIFACTORY_HOST_HOME ]; then | |
echo "creating Artifactory volumes in: $ARTIFACTORY_HOST_HOME" | |
mkdir -p $ARTIFACTORY_HOST_HOME/etc | |
mkdir -p $ARTIFACTORY_HOST_HOME/logs | |
mkdir -p $ARTIFACTORY_HOST_HOME/backup | |
mkdir -p $ARTIFACTORY_HOST_HOME/data | |
echo "copying default configs from Artifactory image to: $ARTIFACTORY_HOST_HOME/etc" | |
docker run --rm \ | |
-v $ARTIFACTORY_HOST_HOME/etc/:/tmp/etc \ | |
$ARTIFACTORY_IMAGE \ | |
/bin/bash -c "cp $ARTIFACTORY_HOME/etc/* /tmp/etc" | |
fi | |
echo "running Artifactory in container: $ARTIFACTORY_CONTAINER_NAME" | |
docker run -d --name $ARTIFACTORY_CONTAINER_NAME -p 80:80 -p 8081:8081 -p 443:443 -p 5000-5002:5000-5002 \ | |
-v $ARTIFACTORY_HOST_HOME/data:$ARTIFACTORY_HOME/data \ | |
-v $ARTIFACTORY_HOST_HOME/logs:$ARTIFACTORY_HOME/logs \ | |
-v $ARTIFACTORY_HOST_HOME/backup:$ARTIFACTORY_HOME/backup \ | |
-v $ARTIFACTORY_HOST_HOME/etc:$ARTIFACTORY_HOME/etc \ | |
$ARTIFACTORY_IMAGE | |
sleep 3 | |
docker logs $ARTIFACTORY_CONTAINER_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment