├── .hadolint.yml ├── .travis.yml ├── Dockerfile ├── README.md └── hooks └── build /.hadolint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | ignored: 4 | - DL3047 # This is actually an invalid rule on Alpine Linux or Busybox based wget 5 | - DL3059 # Separate layers is better for cache leverage, especially for debug, and for not final stage image 6 | - DL3018 # Ignore "Pin versions in apk add" warning, it doesn't matter here 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | dist: focal 4 | 5 | services: 6 | - docker 7 | 8 | stages: 9 | - Static test 10 | - Build test 11 | 12 | jobs: 13 | include: 14 | - stage: Static test 15 | env: 16 | - Test: hadolint 17 | language: minimal 18 | script: 19 | - docker run -i -v $PWD/.hadolint.yml:/.hadolint.yml hadolint/hadolint < Dockerfile 20 | 21 | - stage: Static test 22 | env: 23 | - Test: dockerfile_lint 24 | language: node_js 25 | node_js: 26 | - "18" 27 | script: 28 | - npx --cache .npx dockerfile_lint 29 | cache: 30 | directories: 31 | - .npx 32 | 33 | - stage: Build test 34 | language: minimal 35 | before_script: 36 | - if [[ "$TRAVIS_TAG" =~ ^[0-9]+(\.[0-9]+){2}$ ]]; then 37 | AZCOPY_VERSION="$TRAVIS_TAG"; 38 | export VALID_TAG="true"; 39 | else 40 | AZCOPY_VERSION=$(curl -sLo- https://api.github.com/repos/Azure/azure-storage-azcopy/releases | grep tag_name | head -n 1 | awk -F'"' '{print $4}' | sed 's/^v//g'); 41 | fi 42 | - echo "$AZCOPY_VERSION" 43 | - tag=($(echo $AZCOPY_VERSION | tr "." " ")) 44 | - DOCKER_REPO="$DOCKER_USERNAME/azcopy" 45 | - DOCKER_REPO2="$DOCKER_USERNAME/azcopy" 46 | - DOCKER_PLATFORM="linux/amd64,linux/arm64,linux/arm/v6,linux/arm/v7,linux/386" 47 | script: 48 | - if [ "$TRAVIS_PULL_REQUEST" = "true" ] || [ "true" != "$VALID_TAG" ]; then 49 | docker build --build-arg AZCOPY_VERSION="$AZCOPY_VERSION" -t docker-azcopy:$TRAVIS_COMMIT .; 50 | docker run docker-azcopy:$TRAVIS_COMMIT azcopy --version; 51 | else 52 | mkdir -p ~/.docker/cli-plugins; 53 | wget -nv -O ~/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/v0.10.5/buildx-v0.10.5.linux-amd64; 54 | chmod a+x ~/.docker/cli-plugins/docker-buildx; 55 | docker run --privileged multiarch/qemu-user-static --reset -p yes; 56 | docker buildx create --use --name mybuilder; 57 | docker login -u ${DOCKER_HUB_USER} -p ${DOCKER_HUB_PASS}; 58 | docker login -u ${GHCR_USER} -p ${GHCR_PASS}; 59 | travis_wait 30 docker buildx build --build-arg AZCOPY_VERSION="$AZCOPY_VERSION" -t "$DOCKER_REPO:latest" -t "$DOCKER_REPO2:latest" --platform "$DOCKER_PLATFORM" --push .; 60 | fi 61 | - if [ "true" = "$VALID_TAG" ]; then 62 | docker buildx build --build-arg AZCOPY_VERSION="$AZCOPY_VERSION" -t "$DOCKER_REPO:$AZCOPY_VERSION" -t "$DOCKER_REPO:${tag[0]}.${tag[1]}" -t "$DOCKER_REPO:${tag[0]}" --platform "$DOCKER_PLATFORM" --push .; 63 | docker buildx build --build-arg AZCOPY_VERSION="$AZCOPY_VERSION" -t "$DOCKER_REPO2:$AZCOPY_VERSION" -t "$DOCKER_REPO2:${tag[0]}.${tag[1]}" -t "$DOCKER_REPO2:${tag[0]}" --platform "$DOCKER_PLATFORM" --push .; 64 | fi 65 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG AZCOPY_VERSION 2 | ARG GO_VERSION=1.23 3 | ARG ALPINE_VERSION=3.19 4 | ARG TARGETARCH 5 | 6 | FROM golang:$GO_VERSION-alpine$ALPINE_VERSION as build 7 | ENV GOARCH=$TARGETARCH GOOS=linux 8 | WORKDIR /azcopy 9 | ARG AZCOPY_VERSION 10 | RUN apk add --no-cache build-base 11 | RUN wget "https://github.com/Azure/azure-storage-azcopy/archive/v$AZCOPY_VERSION.tar.gz" -O src.tgz || wget "https://github.com/Azure/azure-storage-azcopy/archive/$AZCOPY_VERSION.tar.gz" -O src.tgz 12 | RUN tar xf src.tgz --strip 1 \ 13 | && go build -o azcopy \ 14 | && ./azcopy --version 15 | 16 | FROM alpine:$ALPINE_VERSION as release 17 | ARG AZCOPY_VERSION 18 | LABEL name="docker-azcopy" 19 | LABEL version="$AZCOPY_VERSION" 20 | LABEL maintainer="Peter Dave Hello " 21 | COPY --from=build /azcopy/azcopy /usr/local/bin 22 | WORKDIR /WORKDIR 23 | CMD [ "azcopy" ] 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker-AzCopy 2 | 3 | [![Build Status](https://app.travis-ci.com/PeterDaveHello/docker-azcopy.svg?branch=master)](https://app.travis-ci.com/PeterDaveHello/docker-azcopy) 4 | [![Docker Hub pulls](https://img.shields.io/docker/pulls/peterdavehello/azcopy.svg)](https://hub.docker.com/r/peterdavehello/azcopy/) 5 | 6 | [![Docker Hub badge](http://dockeri.co/image/peterdavehello/azcopy)](https://hub.docker.com/r/peterdavehello/azcopy/) 7 | 8 | Docker-AzCopy is a Docker image based on Alpine Linux, pre-installed with Azure AzCopy tool. It offers multiple versions of AzCopy to choose from and can be easily utilized and integrated into CI/CD workflows. 9 | 10 | - GitHub: 11 | - Docker Hub: 12 | 13 | See the [AzCopy README](https://github.com/Azure/azure-storage-azcopy/#readme) for more information. 14 | 15 | ## Docker image Repository 16 | 17 | We push the built image to Docker Hub and GitHub Container Registry: 18 | 19 | - GitHub Container Registry: 20 | - `ghcr.io/peterdavehello/azcopy` 21 | - 22 | - Docker Hub: 23 | - `peterdavehello/azcopy` 24 | - 25 | 26 | Use the prefix `ghcr.io/` if you prefer to use GitHub Container Registry. 27 | 28 | ## Versioning 29 | 30 | The Docker image tags available here correspond to Azure AzCopy versions found on [its releases page on GitHub](https://github.com/Azure/azure-storage-azcopy/releases), without the `v` prefix. 31 | 32 | The `latest` tag and short version (version string without the minor or patch version) are also supported. For example, using tag `10` will be the same as using the latest `10.x.y`, whatever the current latest version of v10 is. 33 | 34 | You can find valid versions on the [Docker Hub Tags](https://hub.docker.com/r/peterdavehello/azcopy/tags) page. 35 | 36 | Although most versions of AzCopy have corresponding images here, please note that inactive images may be removed by Docker Hub. For more information, see the Docker blog post "[Scaling Docker's business to serve millions more developers, storage partners, and enterprises](https://www.docker.com/blog/scaling-dockers-business-to-serve-millions-more-developers-storage/)." 37 | 38 | ## Usage 39 | 40 | ```sh 41 | docker run --rm -it -v /local/path/to/mount:/container/path peterdavehello/azcopy[:] azcopy [command] [arguments] 42 | ``` 43 | 44 | For example: 45 | 46 | ```sh 47 | docker run --rm -it -v $PWD/src:/src peterdavehello/azcopy:10.11.0 azcopy sync /src https://azcopydockertest.blob.core.windows.net/$$web 48 | ``` 49 | 50 | You can also confirm its version by: 51 | 52 | ```sh 53 | $ docker run --rm -it -v $PWD/src:/src peterdavehello/azcopy:10.11.0 azcopy --version 54 | 55 | Unable to find image 'peterdavehello/azcopy:10.11.0' locally 56 | 10.11.0: Pulling from peterdavehello/azcopy 57 | 540db60ca938: Already exists 58 | 2bb029cc37b3: Pull complete 59 | 0706491099ca: Pull complete 60 | Digest: sha256:bf339591009673060633cf95c3339e386a3d4e187e206da116547ac081a0b375 61 | Status: Downloaded newer image for peterdavehello/azcopy:10.11.0 62 | azcopy version 10.11.0 63 | ``` 64 | -------------------------------------------------------------------------------- /hooks/build: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ "latest" = "$DOCKER_TAG" ] && [ "master" = "$SOURCE_BRANCH" ]; then 4 | AZCOPY_VERSION=$(curl -sLo- https://api.github.com/repos/Azure/azure-storage-azcopy/releases | grep tag_name | head -n 1 | awk -F'"' '{print $4}' | sed 's/^v//g') 5 | else 6 | AZCOPY_VERSION="$SOURCE_BRANCH" 7 | fi 8 | 9 | docker build --build-arg AZCOPY_VERSION="$AZCOPY_VERSION" -f "$DOCKERFILE_PATH" -t "$IMAGE_NAME" . 10 | --------------------------------------------------------------------------------