Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ variables:
IMAGE_TAG_COMPOSE: $CI_COMMIT_REF_SLUG-$CI_COMMIT_SHORT_SHA-compose
DOCKER_HUB_REPOSITORY: k911/docker-client
DOCKER_TLS_CERTDIR: /certs
DOCKER_RUNNER_VERSION: 20.10.5
DOCKER_VERSION: 20.10.5
DOCKER_COMPOSE_VERSION: 1.29.0
DOCKER_RUNNER_VERSION: 23.0.2
DOCKER_VERSION: 23.0.2
DOCKER_COMPOSE_VERSION: 2.17.2
TRIVY_VERSION: 0.16.0
DOCKER_BUILDX_VERSION: 0.5.1
DOCKER_AWS_ECR_CREDENTIAL_HELPER_VERSION: 0.5.0
DOCKER_PASS_CREDENTIAL_HELPER_VERSION: 0.6.3
DOCKER_BUILDX_VERSION: 0.10.4
DOCKER_AWS_ECR_CREDENTIAL_HELPER_VERSION: 0.6.0
DOCKER_PASS_CREDENTIAL_HELPER_VERSION: 0.7.0
PYTHON_VERSION: "3.9"
ALPINE_VERSION: "3.13"
ALPINE_VERSION: "3.16"

# do not run duplicate "detached" pipelines
# https://docs.gitlab.com/ee/ci/yaml/README.html#workflowrules-templates
Expand Down
18 changes: 8 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# https://github.com/moby/moby/releases
ARG DOCKER_VERSION="20.10.5"
ARG DOCKER_VERSION="23.0.2"

# https://github.com/docker/compose/releases
ARG DOCKER_COMPOSE_VERSION="1.29.0"
ARG DOCKER_COMPOSE_VERSION="2.17.2"

FROM docker:${DOCKER_VERSION} as client

RUN apk add --update jq bash curl git openssh-client pass && \
RUN apk add --update jq bash curl git openssh-client pass dirmngr gpg-agent && \
apk upgrade && \
rm -rf /var/cache/apk/*

# https://github.com/docker/buildx/releases
ARG DOCKER_BUILDX_VERSION="0.5.1"
ARG DOCKER_BUILDX_VERSION="0.10.4"
# https://github.com/awslabs/amazon-ecr-credential-helper/releases
ARG DOCKER_AWS_ECR_CREDENTIAL_HELPER_VERSION="0.5.0"
ARG DOCKER_AWS_ECR_CREDENTIAL_HELPER_VERSION="0.6.0"
# https://github.com/docker/docker-credential-helpers/releases
ARG DOCKER_PASS_CREDENTIAL_HELPER_VERSION="0.6.3"
ARG DOCKER_PASS_CREDENTIAL_HELPER_VERSION="0.7.0"

# install docker buildx
RUN wget "https://github.com/docker/buildx/releases/download/v${DOCKER_BUILDX_VERSION}/buildx-v${DOCKER_BUILDX_VERSION}.linux-amd64" && \
Expand All @@ -27,11 +27,9 @@ RUN wget "https://github.com/docker/buildx/releases/download/v${DOCKER_BUILDX_VE
mv docker-credential-ecr-login /usr/local/bin/docker-credential-ecr-login && \
chmod a+x /usr/local/bin/docker-credential-ecr-login && \
# install docker pass credential helper
wget "https://github.com/docker/docker-credential-helpers/releases/download/v${DOCKER_PASS_CREDENTIAL_HELPER_VERSION}/docker-credential-pass-v${DOCKER_PASS_CREDENTIAL_HELPER_VERSION}-amd64.tar.gz" && \
tar -xvf "docker-credential-pass-v${DOCKER_PASS_CREDENTIAL_HELPER_VERSION}-amd64.tar.gz" && \
wget "https://github.com/docker/docker-credential-helpers/releases/download/v${DOCKER_PASS_CREDENTIAL_HELPER_VERSION}/docker-credential-pass-v${DOCKER_PASS_CREDENTIAL_HELPER_VERSION}.linux-amd64" >> "docker-credential-pass" && \
mv docker-credential-pass /usr/local/bin/docker-credential-pass && \
chmod a+x /usr/local/bin/docker-credential-pass && \
rm "docker-credential-pass-v${DOCKER_PASS_CREDENTIAL_HELPER_VERSION}-amd64.tar.gz"
chmod a+x /usr/local/bin/docker-credential-pass

COPY scripts/gitlab-docker-registry-login.sh /usr/local/bin/gitlab-docker-registry-login
COPY scripts/docker-registry-login.sh /usr/local/bin/docker-registry-login
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ docker-compose build --pull
### Docker only

```sh
DOCKER_VERSION="20.10.5"
DOCKER_BUILDX_VERSION="0.5.1"
DOCKER_AWS_ECR_CREDENTIAL_HELPER_VERSION="0.5.0"
DOCKER_VERSION="23.0.2"
DOCKER_BUILDX_VERSION="0.10.4"
DOCKER_AWS_ECR_CREDENTIAL_HELPER_VERSION="0.6.0"
docker build --pull --build-arg "DOCKER_VERSION=$DOCKER_VERSION" \
--build-arg "DOCKER_BUILDX_VERSION=$DOCKER_BUILDX_VERSION" \
--build-arg "DOCKER_AWS_ECR_CREDENTIAL_HELPER_VERSION=$DOCKER_AWS_ECR_CREDENTIAL_HELPER_VERSION" \
--tag "registry.gitlab.com/swoole-bundle/docker-client:$DOCKER_VERSION" .
--tag "docker.io/pixelfederation/docker-client:$DOCKER_VERSION" .

docker run --rm -ti -v "/var/run/docker.sock:/var/run/docker.sock" "registry.gitlab.com/swoole-bundle/docker-client:$DOCKER_VERSION" info
docker run --rm -ti -v "/var/run/docker.sock:/var/run/docker.sock" "docker.io/pixelfederation/docker-client:$DOCKER_VERSION" info
```

docker push registry.gitlab.com/swoole-bundle/docker-client
docker push docker.io/pixelfederation/docker-client

## GitLab Examples

Expand All @@ -33,7 +33,7 @@ docker push registry.gitlab.com/swoole-bundle/docker-client
```yaml
build-docker-image:
stage: build
image: registry.gitlab.com/swoole-bundle/docker-client:latest
image: docker.io/pixelfederation/docker-client:latest
variables:
DOCKER_TLS_CERTDIR: /certs
DOCKER_BUILDX_CONTEXT_CREATE: "1"
Expand All @@ -56,15 +56,15 @@ build-docker-image:
```yaml
build-docker-image:
stage: build
image: registry.gitlab.com/swoole-bundle/docker-client:latest
image: docker.io/pixelfederation/docker-client:latest
variables:
DOCKER_TLS_CERTDIR: /certs
AWS_ACCOUNT_ID: xxxxx
AWS_DEFAULT_REGION: xxxxx
AWS_ACCESS_KEY_ID: xxxxx
AWS_SECRET_ACCESS_KEY: xxxxx
services:
- docker:20.10.5-dind
- docker:23.0.2-dind
before_script:
- aws-ecr-login
script:
Expand All @@ -77,11 +77,11 @@ build-docker-image:
```yaml
build-docker-image:
stage: build
image: registry.gitlab.com/swoole-bundle/docker-client:latest
image: docker.io/pixelfederation/docker-client:latest
variables:
DOCKER_TLS_CERTDIR: /certs
services:
- docker:20.10.5-dind
- docker:23.0.2-dind
before_script:
- gitlab-docker-registry-login
script:
Expand Down
18 changes: 9 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ version: "3.9"

x-aliases:
- &DEFAULT_ARGS
DOCKER_VERSION: ${DOCKER_VERSION:-20.10.5}
DOCKER_COMPOSE_VERSION: ${DOCKER_COMPOSE_VERSION:-1.29.0}
DOCKER_BUILDX_VERSION: ${DOCKER_BUILDX_VERSION:-0.5.1}
DOCKER_AWS_ECR_CREDENTIAL_HELPER_VERSION: ${DOCKER_AWS_ECR_CREDENTIAL_HELPER_VERSION:-0.5.0}
DOCKER_PASS_CREDENTIAL_HELPER_VERSION: ${DOCKER_PASS_CREDENTIAL_HELPER_VERSION:-0.6.3}
DOCKER_VERSION: ${DOCKER_VERSION:-23.0.2}
DOCKER_COMPOSE_VERSION: ${DOCKER_COMPOSE_VERSION:-2.17.2}
DOCKER_BUILDX_VERSION: ${DOCKER_BUILDX_VERSION:-0.10.4}
DOCKER_AWS_ECR_CREDENTIAL_HELPER_VERSION: ${DOCKER_AWS_ECR_CREDENTIAL_HELPER_VERSION:-0.6.0}
DOCKER_PASS_CREDENTIAL_HELPER_VERSION: ${DOCKER_PASS_CREDENTIAL_HELPER_VERSION:-0.7.0}

volumes:
dind-ca: {}
Expand All @@ -18,7 +18,7 @@ networks:

services:
local:
image: ${REGISTRY:-registry.gitlab.com}/${NAMESPACE:-swoole-bundle}/${PROJECT_NAME:-docker-client}-local:${IMAGE_TAG:-local}
image: ${REGISTRY:-docker.io}/${NAMESPACE:-pixelfederation}/${PROJECT_NAME:-docker-client}-local:${IMAGE_TAG:-local}
build:
context: .
target: "${TARGET:-client}"
Expand All @@ -29,7 +29,7 @@ services:
- ./examples:/workspace:ro

dind:
image: docker.io/docker:${DOCKER_VERSION:-20.10.5}-dind
image: docker.io/docker:${DOCKER_VERSION:-23.0.2}-dind
restart: always
privileged: true
environment:
Expand All @@ -44,7 +44,7 @@ services:
- dind

remote:
image: ${REGISTRY:-registry.gitlab.com}/${NAMESPACE:-swoole-bundle}/${PROJECT_NAME:-docker-client}-remote:${IMAGE_TAG:-local}
image: ${REGISTRY:-docker.io}/${NAMESPACE:-pixelfederation}/${PROJECT_NAME:-docker-client}-remote:${IMAGE_TAG:-local}
depends_on:
- dind
build:
Expand All @@ -66,6 +66,6 @@ services:
- dind

example-nginx:
image: ${REGISTRY:-registry.gitlab.com}/${NAMESPACE:-swoole-bundle}/${PROJECT_NAME:-docker-client}-example-nginx:${IMAGE_TAG:-local}
image: ${REGISTRY:-docker.io}/${NAMESPACE:-pixelfederation}/${PROJECT_NAME:-docker-client}-example-nginx:${IMAGE_TAG:-local}
build:
context: examples/nginx