-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a79079
commit 024c5e0
Showing
10 changed files
with
207 additions
and
7 deletions.
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
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,25 @@ | ||
ARG AWS_CLI_VERSION=2.3.5 | ||
ARG PHP_VERSION=8.0 | ||
|
||
FROM amazon/aws-cli:${AWS_CLI_VERSION} | ||
|
||
ARG PHP_VERSION | ||
ARG AWS_CLI_VERSION | ||
|
||
LABEL version="${AWS_CLI_VERSION}-${PHP_VERSION}" | ||
LABEL aws_cli_version="${AWS_CLI_VERSION}" | ||
LABEL php_version="${PHP_VERSION}" | ||
LABEL maintainer="[email protected]" | ||
|
||
RUN amazon-linux-extras enable php${PHP_VERSION} \ | ||
&& yum install -y \ | ||
jq \ | ||
git \ | ||
php \ | ||
php-mbstring \ | ||
php-gmp \ | ||
php-mcrypt \ | ||
php-xml \ | ||
&& yum clean all | ||
|
||
ENTRYPOINT ['/usr/local/bin/aws'] |
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,25 @@ | ||
ARG AWS_CLI_VERSION=2.3.5 | ||
ARG PHP_VERSION=8.0 | ||
|
||
FROM amazon/aws-cli:${AWS_CLI_VERSION} | ||
|
||
ARG PHP_VERSION | ||
ARG AWS_CLI_VERSION | ||
|
||
LABEL version="${AWS_CLI_VERSION}-${PHP_VERSION}" | ||
LABEL aws_cli_version="${AWS_CLI_VERSION}" | ||
LABEL php_version="${PHP_VERSION}" | ||
LABEL maintainer="[email protected]" | ||
|
||
RUN amazon-linux-extras enable php${PHP_VERSION} \ | ||
&& yum install -y \ | ||
jq \ | ||
git \ | ||
php \ | ||
php-mbstring \ | ||
php-gmp \ | ||
php-mcrypt \ | ||
php-xml \ | ||
&& yum clean all | ||
|
||
ENTRYPOINT ['/usr/local/bin/aws'] |
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,87 @@ | ||
ARCH:=$(shell uname -m) | ||
ENV:="dev" | ||
LATEST_TAG:=$(shell if [ $(ENV) = "prod" ]; then \ | ||
echo "latest"; \ | ||
else \ | ||
echo "$(ENV)"; \ | ||
fi) | ||
SCOPE_SUFFIX:=$(shell if [ $(ENV) = "prod" ]; then \ | ||
echo ""; \ | ||
else \ | ||
echo "-$(ENV)"; \ | ||
fi) | ||
EXTENSION:=$(shell case "$(ARCH)" in \ | ||
("arm64"|"aarch64") echo ".arm64" ;; \ | ||
("x86_64") echo "" ;; \ | ||
(*) echo $(ARCH) ;; \ | ||
esac) | ||
|
||
.PHONY: build | ||
build: | ||
@find . -type f -name "Dockerfile${EXTENSION}" | while read -r FILE; do \ | ||
docker build -f Dockerfile -t chatwork/`basename $$PWD` .; \ | ||
version=$$(docker inspect -f {{.Config.Labels.version}} chatwork/`basename $$PWD`:latest); \ | ||
aws_cli_version=$$(docker inspect -f {{.Config.Labels.aws_cli_version}} chatwork/`basename $$PWD`:latest); \ | ||
php_version=$$(docker inspect -f {{.Config.Labels.php_version}} chatwork/`basename $$PWD`:latest); \ | ||
if [ -n "$$version" ] && [ -n "$$aws_cli_version" ] && [ -n "$$php_version" ]; then \ | ||
docker tag chatwork/`basename $$PWD`:latest chatwork/`basename $$PWD`:$$version; \ | ||
fi \ | ||
done | ||
|
||
.PHONY: check | ||
check: | ||
@version=$$(docker inspect -f {{.Config.Labels.version}} chatwork/`basename $$PWD`:latest); \ | ||
aws_cli_version=$$(docker inspect -f {{.Config.Labels.aws_cli_version}} chatwork/`basename $$PWD`:latest); \ | ||
php_version=$$(docker inspect -f {{.Config.Labels.php_version}} chatwork/`basename $$PWD`:latest); \ | ||
if [[ -z $$version ]]; then \ | ||
echo "\033[91mError: version is not defined in Dockerfile.\033[0m"; \ | ||
exit 1; \ | ||
fi; \ | ||
if [[ -z $$aws_cli_version ]]; then \ | ||
echo "\033[91mError: aws_cli_version is not defined in Dockerfile.\033[0m"; \ | ||
exit 1; \ | ||
fi; \ | ||
if [[ -z $$php_version ]]; then \ | ||
echo "\033[91mError: php_version is not defined in Dockerfile.\033[0m"; \ | ||
exit 1; \ | ||
fi; \ | ||
echo "\033[92mno problem.\033[0m"; | ||
|
||
.PHONY: test | ||
test: | ||
docker-compose -f docker-compose.test.yml up --build --no-start sut | ||
docker cp $(shell pwd)/goss `basename $$PWD`:/goss | ||
docker-compose -f docker-compose.test.yml up --no-recreate --exit-code-from sut sut | ||
|
||
.PHONY: push | ||
push: | ||
@version=$$(docker inspect -f {{.Config.Labels.version}} chatwork/`basename $$PWD`:latest); \ | ||
if docker inspect --format='{{index .RepoDigests 0}}' chatwork/$$(basename $$PWD):$$version >/dev/null 2>&1; then \ | ||
echo "no changes"; \ | ||
else \ | ||
docker tag chatwork/`basename $$PWD`:latest chatwork/`basename $$PWD`:$$version-$(ARCH)$(SCOPE_SUFFIX); \ | ||
docker push chatwork/`basename $$PWD`:$$version-$(ARCH)$(SCOPE_SUFFIX); \ | ||
fi | ||
|
||
.PHONY: manifest\:push | ||
manifest\:push: | ||
@version=$$(docker inspect -f {{.Config.Labels.version}} chatwork/`basename $$PWD`:latest); \ | ||
if docker inspect --format='{{index .RepoDigests 0}}' chatwork/$$(basename $$PWD):$$version >/dev/null 2>&1; then \ | ||
echo "no changes"; \ | ||
else \ | ||
docker pull chatwork/`basename $$PWD`:$$version-aarch64$(SCOPE_SUFFIX); \ | ||
docker pull chatwork/`basename $$PWD`:$$version-x86_64$(SCOPE_SUFFIX); \ | ||
arm64_digest=$$(docker inspect -f '{{index .RepoDigests 0}}' chatwork/`basename $$PWD`:$$version-aarch64$(SCOPE_SUFFIX)); \ | ||
amd64_digest=$$(docker inspect -f '{{index .RepoDigests 0}}' chatwork/`basename $$PWD`:$$version-x86_64$(SCOPE_SUFFIX)); \ | ||
docker buildx imagetools create -t chatwork/`basename $$PWD`:$$version$(SCOPE_SUFFIX) $$arm64_digest $$amd64_digest; \ | ||
docker buildx imagetools create -t chatwork/`basename $$PWD`:$(LATEST_TAG) $$arm64_digest $$amd64_digest; \ | ||
hub-tool tag rm chatwork/`basename $$PWD`:$$version-aarch64$(SCOPE_SUFFIX) -f; \ | ||
hub-tool tag rm chatwork/`basename $$PWD`:$$version-x86_64$(SCOPE_SUFFIX) -f; \ | ||
fi | ||
|
||
.PHONY: manifest\:succeed-message | ||
manifest\:succeed-message: | ||
@version=$$(docker inspect -f {{.Config.Labels.version}} chatwork/aws-cli-php:latest); \ | ||
echo "Released new tags."; \ | ||
echo "- chatwork/aws-cli-php:$$version$(SCOPE_SUFFIX)"; \ | ||
echo "- chatwork/aws-cli-php:$(LATEST_TAG)"; |
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,9 @@ | ||
# aws-cli-php | ||
|
||
aws-cli-php is an image of [aws-cli](https://hub.docker.com/r/amazon/aws-cli) with php | ||
|
||
## Usage | ||
|
||
``` | ||
$ docker run -it chatwork/aws-cli-php 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,20 @@ | ||
version: '3' | ||
services: | ||
aws-cli-php: | ||
build: | ||
context: . | ||
image: chatwork/aws-cli-php | ||
entrypoint: /bin/bash | ||
sut: | ||
image: chatwork/dgoss:latest | ||
environment: | ||
GOSS_FILES_PATH: /goss | ||
GOSS_FILES_STRATEGY: cp | ||
entrypoint: "" | ||
command: /usr/local/bin/dgoss run --entrypoint "" chatwork/aws-cli-php tail -f /dev/null | ||
container_name: aws-cli-php | ||
volumes: | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
- ./goss/goss.yaml:/goss/goss.yaml | ||
depends_on: | ||
- aws-cli-php |
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,8 @@ | ||
command: | ||
php -v: | ||
exit-status: 0 | ||
stdout: | ||
- "/^PHP 8.[0-9]+/" | ||
|
||
aws help: | ||
exit-status: 0 |
Empty file.
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 @@ | ||
dependencies: | ||
awscli: | ||
version: 2.3.5 | ||
previousVersion: 2.3.4 |
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,18 @@ | ||
provisioners: | ||
textReplace: | ||
Dockerfile: | ||
from: "ARG AWS_CLI_VERSION={{ .awscli.previousVersion }}" | ||
to: "ARG AWS_CLI_VERSION={{ .awscli.version }}" | ||
Dockerfile.arm64: | ||
from: "ARG AWS_CLI_VERSION={{ .awscli.previousVersion }}" | ||
to: "ARG AWS_CLI_VERSION={{ .awscli.version }}" | ||
goss/goss.yaml: | ||
from: "- {{ .awscli.previousVersion }}" | ||
to: "- {{ .awscli.version }}" | ||
|
||
dependencies: | ||
aws-cli: | ||
releasesFrom: | ||
dockerImageTags: | ||
source: amazon/aws-cli | ||
version: "> 2.3.5" |