-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from theohbrothers/docs/simplify-readme-and-ad…
…d-simpler-examples Docs: Simplify readme and add simpler examples
- Loading branch information
Showing
72 changed files
with
999 additions
and
448 deletions.
There are no files selected for viewing
3 changes: 1 addition & 2 deletions
3
docs/examples/advanced-component-chaining-copies-variables/generate/definitions/FILES.ps1
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
# Files' definition | ||
$FILES = @( | ||
'.gitlab-ci.yml' | ||
'README.md' | ||
) | ||
) |
52 changes: 0 additions & 52 deletions
52
docs/examples/advanced-component-chaining-copies-variables/generate/definitions/VARIANTS.ps1
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
3 changes: 1 addition & 2 deletions
3
docs/examples/basic-component-chaining/generate/definitions/FILES.ps1
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
# Files' definition | ||
$FILES = @( | ||
'.gitlab-ci.yml' | ||
'README.md' | ||
) | ||
) |
22 changes: 1 addition & 21 deletions
22
docs/examples/basic-component-chaining/generate/definitions/VARIANTS.ps1
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
32 changes: 32 additions & 0 deletions
32
docs/examples/basic-component-chaining/generate/templates/Dockerfile.ps1
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,32 @@ | ||
@" | ||
FROM alpine:3.8 | ||
echo "My tag is $( $VARIANT['tag'] )" | ||
"@ | ||
|
||
if ('curl' -in $VARIANT['components']) { | ||
@' | ||
# Install curl | ||
RUN apk update \ | ||
&& apk add --no-cache \ | ||
curl \ | ||
&& rm -rf /var/cache/apk/* | ||
'@ | ||
} | ||
|
||
if ('git' -in $VARIANT['components']) { | ||
@' | ||
# Install git | ||
RUN apk update \ | ||
&& apk add --no-cache \ | ||
git \ | ||
&& rm -rf /var/cache/apk/* | ||
'@ | ||
} | ||
|
||
@' | ||
CMD ["crond", "-f"] | ||
'@ |
3 changes: 0 additions & 3 deletions
3
docs/examples/basic-component-chaining/generate/templates/Dockerfile/Dockerfile.footer.ps1
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
docs/examples/basic-component-chaining/generate/templates/Dockerfile/Dockerfile.header.ps1
This file was deleted.
Oops, something went wrong.
3 changes: 1 addition & 2 deletions
3
docs/examples/basic-component-chaining/variants/curl-git/Dockerfile
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 |
---|---|---|
@@ -1,15 +1,14 @@ | ||
FROM alpine:3.8 | ||
|
||
echo "My tag is curl-git" | ||
# Install curl | ||
RUN apk update \ | ||
&& apk add --no-cache \ | ||
curl \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
# Install git | ||
RUN apk update \ | ||
&& apk add --no-cache \ | ||
git \ | ||
&& rm -rf /var/cache/apk/* | ||
|
||
CMD ["crond", "-f"] |
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,66 @@ | ||
image: docker:latest | ||
services: | ||
- docker:dind | ||
variables: | ||
DOCKER_DRIVER: overlay2 | ||
|
||
stages: | ||
- build | ||
|
||
.build_template: &build_definition | ||
stage: build | ||
only: | ||
refs: | ||
- branches | ||
- /^v(?:\d+\.)+\d+$/ | ||
variables: | ||
- $VARIANT_TAG | ||
- $VARIANT_TAG_WITH_VERSION | ||
- $VARIANT_BUILD_DIR | ||
except: | ||
refs: | ||
- master | ||
before_script: | ||
- date '+%Y-%m-%d %H:%M:%S %z' | ||
|
||
# Login to Docker Hub registry | ||
- echo "${DOCKERHUB_REGISTRY_PASSWORD}" | docker login -u "${DOCKERHUB_REGISTRY_USER}" --password-stdin | ||
|
||
# Login to GitLab registry | ||
- echo "${CI_REGISTRY_PASSWORD}" | docker login -u "${CI_REGISTRY_USER}" --password-stdin "${CI_REGISTRY}" | ||
|
||
script: | ||
- date '+%Y-%m-%d %H:%M:%S %z' | ||
|
||
- docker build | ||
-t "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG}" | ||
-t "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_VERSION}" | ||
-t "${CI_REGISTRY_IMAGE}:${VARIANT_TAG}" | ||
-t "${CI_REGISTRY_IMAGE}:${VARIANT_TAG_WITH_VERSION}" | ||
"${VARIANT_BUILD_DIR}" | ||
|
||
- date '+%Y-%m-%d %H:%M:%S %z' | ||
|
||
# Push to Docker Hub registry. E.g. 'namespace/my-project:tag' | ||
- docker push "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG}" | ||
- docker push "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_VERSION}" | ||
|
||
# Push to GitLab registry. E.g. 'registry.gitlab.com/namespace/my-project:tag | ||
- docker push "${CI_REGISTRY_IMAGE}:${VARIANT_TAG}" | ||
- docker push "${CI_REGISTRY_IMAGE}:${VARIANT_TAG_WITH_VERSION}" | ||
|
||
after_script: | ||
- date '+%Y-%m-%d %H:%M:%S %z' | ||
|
||
# Log out of Docker Hub registry | ||
- docker logout | ||
|
||
# Log out of GitLab registry | ||
- docker logout "${CI_REGISTRY}" | ||
|
||
build-curl: | ||
<<: *build_definition | ||
variables: | ||
VARIANT_TAG: curl | ||
VARIANT_TAG_WITH_VERSION: curl-$CI_COMMIT_REF_NAME | ||
VARIANT_BUILD_DIR: variants/curl |
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,7 @@ | ||
# basic | ||
|
||
## Tags | ||
|
||
| Tag | Dockerfile Build Context | | ||
|:-------:|:---------:| | ||
| `:curl` | [View](variants/curl ) | |
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 @@ | ||
hello world |
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,4 @@ | ||
$FILES = @( | ||
'.gitlab-ci.yml' | ||
'README.md' | ||
) |
13 changes: 13 additions & 0 deletions
13
docs/examples/basic-copies/generate/definitions/VARIANTS.ps1
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 @@ | ||
$VARIANTS = @( | ||
@{ | ||
tag = 'curl' | ||
} | ||
) | ||
|
||
$VARIANTS_SHARED = @{ | ||
buildContextFiles = @{ | ||
copies = @( | ||
'/app' | ||
) | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
docs/examples/basic-copies/generate/templates/.gitlab-ci.yml.ps1
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,75 @@ | ||
@' | ||
image: docker:latest | ||
services: | ||
- docker:dind | ||
variables: | ||
DOCKER_DRIVER: overlay2 | ||
stages: | ||
- build | ||
.build_template: &build_definition | ||
stage: build | ||
only: | ||
refs: | ||
- branches | ||
- /^v(?:\d+\.)+\d+$/ | ||
variables: | ||
- $VARIANT_TAG | ||
- $VARIANT_TAG_WITH_VERSION | ||
- $VARIANT_BUILD_DIR | ||
except: | ||
refs: | ||
- master | ||
before_script: | ||
- date '+%Y-%m-%d %H:%M:%S %z' | ||
# Login to Docker Hub registry | ||
- echo "${DOCKERHUB_REGISTRY_PASSWORD}" | docker login -u "${DOCKERHUB_REGISTRY_USER}" --password-stdin | ||
# Login to GitLab registry | ||
- echo "${CI_REGISTRY_PASSWORD}" | docker login -u "${CI_REGISTRY_USER}" --password-stdin "${CI_REGISTRY}" | ||
script: | ||
- date '+%Y-%m-%d %H:%M:%S %z' | ||
- docker build | ||
-t "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG}" | ||
-t "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_VERSION}" | ||
-t "${CI_REGISTRY_IMAGE}:${VARIANT_TAG}" | ||
-t "${CI_REGISTRY_IMAGE}:${VARIANT_TAG_WITH_VERSION}" | ||
"${VARIANT_BUILD_DIR}" | ||
- date '+%Y-%m-%d %H:%M:%S %z' | ||
# Push to Docker Hub registry. E.g. 'namespace/my-project:tag' | ||
- docker push "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG}" | ||
- docker push "${DOCKERHUB_REGISTRY_USER}/${CI_PROJECT_NAME}:${VARIANT_TAG_WITH_VERSION}" | ||
# Push to GitLab registry. E.g. 'registry.gitlab.com/namespace/my-project:tag | ||
- docker push "${CI_REGISTRY_IMAGE}:${VARIANT_TAG}" | ||
- docker push "${CI_REGISTRY_IMAGE}:${VARIANT_TAG_WITH_VERSION}" | ||
after_script: | ||
- date '+%Y-%m-%d %H:%M:%S %z' | ||
# Log out of Docker Hub registry | ||
- docker logout | ||
# Log out of GitLab registry | ||
- docker logout "${CI_REGISTRY}" | ||
'@ | ||
|
||
$( $VARIANTS | % { | ||
@" | ||
build-$( $_['tag'] ): | ||
<<: *build_definition | ||
variables: | ||
VARIANT_TAG: $( $_['tag'] ) | ||
VARIANT_TAG_WITH_VERSION: $( $_['tag'] )-`$CI_COMMIT_REF_NAME | ||
VARIANT_BUILD_DIR: $( $_['build_dir_rel'] ) | ||
"@ | ||
}) |
Oops, something went wrong.