-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build and push docker image to containers registry
- Loading branch information
1 parent
2ceb944
commit e16f7aa
Showing
9 changed files
with
191 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Create container based on Ubuntu-22.04 Jammy Jellyfish image | ||
FROM mcr.microsoft.com/mirror/docker/library/ubuntu:22.04 | ||
|
||
# Copy azcopy binary to executable path | ||
COPY ./azcopy /usr/local/bin/ | ||
|
||
# Install dependencies | ||
RUN \ | ||
apt update && \ | ||
apt --fix-broken install | ||
|
||
ENTRYPOINT ["azcopy"] | ||
CMD ["--help"] | ||
|
||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Create container based on Ubuntu-22.04 Jammy Jellyfish image | ||
FROM --platform=linux/arm64 mcr.microsoft.com/mirror/docker/library/ubuntu:22.04 | ||
|
||
# Copy azcopy binary to executable path | ||
COPY ./azcopy /usr/local/bin/ | ||
|
||
# Install dependencies | ||
RUN \ | ||
apt update && \ | ||
apt --fix-broken install | ||
|
||
ENTRYPOINT ["azcopy"] | ||
CMD ["--help"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Create container based on Ubuntu-22.04 Jammy Jellyfish image | ||
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 | ||
|
||
# Copy azcopy binary to executable path | ||
COPY ./azcopy /usr/local/bin/ | ||
|
||
# Install dependencies | ||
RUN \ | ||
apt update && \ | ||
apt --fix-broken install | ||
|
||
ENTRYPOINT ["azcopy"] | ||
CMD ["--help"] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
echo "Using Go - $(go version)" | ||
rm -rf azcopy | ||
rm -rf azure-storage-azcopy | ||
go build -o azcopy |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Build azcopy binary | ||
cd .. | ||
echo "Building azcopy" | ||
./docker/build.sh | ||
ls -l azcopy | ||
|
||
# Build azcopy binary | ||
ver=`../azcopy --version | cut -d " " -f 3` | ||
tag="azure-azcopy.$ver" | ||
|
||
./buildcontainer.sh Dockerfile x86_64 | ||
|
||
# If build was successful then launch a container instance | ||
status=`docker images | grep $tag` | ||
|
||
if [ $? = 0 ]; then | ||
echo " **** Build successful, running container now ******" | ||
docker run -it --rm \ | ||
--cap-add=SYS_ADMIN \ | ||
--device=/dev/fuse \ | ||
--security-opt apparmor:unconfined \ | ||
-e AZURE_STORAGE_ACCOUNT \ | ||
-e AZURE_STORAGE_ACCESS_KEY \ | ||
$tag | ||
else | ||
echo "Failed to build docker image" | ||
fi |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
# Build azcopy binary | ||
cd .. | ||
echo "Building azcopy" | ||
./docker/build.sh | ||
ls -l azcopy | ||
|
||
ver=`./azcopy --version | cut -d " " -f 3` | ||
tag="azure-azcopy-$2.$ver" | ||
|
||
# Cleanup older container image from docker | ||
sudo docker image rm $tag -f | ||
|
||
# Build new container image using current code | ||
echo "Build container for azcopy" | ||
sudo docker build -t $tag -f $1 . | ||
|
||
# List all images to verify if new image is created | ||
sudo docker images | ||
|
||
# Image build is executed so we can clean up temp executable from here | ||
rm -rf ./azcopy | ||
|
||
# If build was successful then launch a container instance | ||
status=`sudo docker images | grep $tag` | ||
echo $status |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
# Cleanup old installation | ||
sudo apt remove docker-desktop | ||
rm-r $HOME/.docker/desktop | ||
sudo rm/usr/local/bin/com.docker.cli | ||
sudo apt purge docker-desktop | ||
sudo apt-get update | ||
|
||
# Install certificates and pre-requisites | ||
sudo apt-get install ca-certificates curl gnupg lsb-release -y | ||
sudo mkdir -p /etc/apt/keyrings | ||
|
||
# Create keyring for docker | ||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | ||
|
||
# Create file for installation | ||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"| sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | ||
|
||
# Install docker | ||
sudo apt-get update | ||
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y | ||
sudo apt-get update | ||
|
||
# Resolve permission issues to connect to docker socket | ||
sudo groupadd docker | ||
sudo usermod -aG docker $USER | ||
sudo chown root:docker /var/run/docker.sock | ||
sudo chown "$USER":"$USER" /home/"$USER"/.docker -R | ||
sudo chmod g+rwx "$HOME/.docker" -R | ||
|
||
# Delete old azcopy image | ||
docker rmi `docker images | grep azcopy | cut -d " " -f1` | ||
|
||
# Remove existing images | ||
docker system prune -f | ||
|
||
# Start docker service | ||
sudo service docker start | ||
|
||
# List docker container images | ||
docker images ls | ||
|
||
# List docker instances running | ||
docker container ls | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
|
||
ver=`../azcopy --version | cut -d " " -f 3` | ||
image="azure-azcopy-$3.$ver" | ||
|
||
sudo docker login azcopy.azurecr.io --username $1 --password $2 | ||
|
||
# Publish Ubn-22 container image | ||
sudo docker tag $image:latest azcopy.azurecr.io/$image | ||
sudo docker push azcopy.azurecr.io/$image | ||
|
||
sudo docker logout azcopy.azurecr.io | ||
|
This file contains 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