Skip to content

Commit 93ebdda

Browse files
authored
Merge pull request #1 from fbrissi/master
First Version
2 parents ffc3977 + 48612da commit 93ebdda

File tree

10 files changed

+257
-1
lines changed

10 files changed

+257
-1
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Sync Docker Hub Description
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- README.md
9+
- .github/workflows/docker-description.yml
10+
11+
jobs:
12+
docker-description:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Sync Docker Hub Description
18+
uses: peter-evans/dockerhub-description@v2
19+
env:
20+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
21+
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
22+
DOCKERHUB_REPOSITORY: kooldev/toolkit

.github/workflows/docker.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CI
2+
on: [push, pull_request]
3+
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout code
9+
uses: actions/checkout@master
10+
11+
- name: Build images
12+
run: |
13+
docker build --pull -t kooldev/toolkit:terraform-aws terraform-aws
14+
docker build -t kooldev/toolkit:full full
15+
16+
- name: Test docker images
17+
run: |
18+
docker run -t --rm kooldev/toolkit:terraform-aws terraform --version
19+
docker run -t --rm kooldev/toolkit:terraform-aws aws --version
20+
21+
docker run -t --rm kooldev/toolkit:full terraform --version
22+
docker run -t --rm kooldev/toolkit:full aws --version
23+
docker run -t --rm kooldev/toolkit:full kubectl --help
24+
docker run -t --rm kooldev/toolkit:full docker --version
25+
docker run -t --rm kooldev/toolkit:full docker-compose --version
26+
docker run -t --rm kooldev/toolkit:full doctl version
27+
docker run -t --rm kooldev/toolkit:full helm version
28+
29+
deploy:
30+
needs: build
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Push to Hub
34+
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository == 'kool-dev/docker-toolkit'
35+
env:
36+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
37+
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
38+
run: |
39+
echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
40+
docker push kooldev/toolkit:terraform-aws
41+
docker push kooldev/toolkit:full

.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# misc
4+
.DS_Store
5+
6+
### IntelliJ IDEA ###
7+
.idea
8+
*.iws
9+
*.iml
10+
*.ipr
11+
out/
12+
13+
### NetBeans ###
14+
/nbproject/private/
15+
/nbbuild/
16+
/dist/
17+
/nbdist/
18+
/.nb-gradle/
19+
20+
### VS Code ###
21+
.vscode/

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) Firework Web <[email protected]>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,39 @@
1-
# docker-toolkit
1+
# kool-dev/toolkit
2+
3+
4+
Image with toolkit to use by development. This images can be help to use with [kool](https://github.com/kool-dev/kool).
5+
6+
## Usage
7+
8+
With `docker run`:
9+
10+
### Terraform with Aws Cli
11+
```sh
12+
docker run -it --rm kooldev/toolkit:terraform-aws terraform --version
13+
docker run -it --rm kooldev/toolkit:terraform-aws aws --version
14+
```
15+
16+
### Full
17+
```sh
18+
docker run -it --rm kooldev/toolkit:full terraform --version
19+
docker run -it --rm kooldev/toolkit:full aws --version
20+
docker run -it --rm kooldev/toolkit:full kubectl --help
21+
docker run -it --rm kooldev/toolkit:full docker --version
22+
docker run -it --rm kooldev/toolkit:full docker-compose --version
23+
docker run -it --rm kooldev/toolkit:full doctl version
24+
docker run -it --rm kooldev/toolkit:full helm version
25+
```
26+
27+
### Available Tags
28+
29+
- terraform-aws
30+
- full
31+
32+
### Variables
33+
34+
**TF_TOKEN**: The token to `.terraformrc` file
35+
**TF_HOSTNAME**: The hostname to `.terraformrc` file
36+
37+
## License
38+
39+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

build.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
docker build --pull -t kooldev/toolkit:terraform-aws terraform-aws
4+
docker build -t kooldev/toolkit:full full

full/Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
FROM docker/compose:alpine-1.26.2 as compose
2+
3+
FROM kooldev/toolkit:terraform-aws
4+
5+
ARG HELM_VERSION=3.2.0
6+
ARG DOCTL_VERSION=1.41.0
7+
ARG KUBECTL_VERSION=1.18.2
8+
9+
WORKDIR /tmp
10+
11+
RUN apk add --update --no-cache --virtual .build-deps curl ca-certificates
12+
13+
# Install docker and docker-compose
14+
COPY --from=compose /usr/local/bin/docker /usr/local/bin/docker
15+
COPY --from=compose /usr/local/bin/docker-compose /usr/local/bin/docker-compose
16+
17+
# Install kubectl
18+
RUN curl -L https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl && \
19+
chmod +x /usr/local/bin/kubectl
20+
21+
# Install helm
22+
RUN curl -L https://get.helm.sh/helm-v${HELM_VERSION}-linux-amd64.tar.gz | tar xz && \
23+
mv linux-amd64/helm /usr/local/bin/helm && \
24+
chmod +x /usr/local/bin/helm
25+
26+
# Install doctl
27+
RUN curl -L https://github.com/digitalocean/doctl/releases/download/v${DOCTL_VERSION}/doctl-${DOCTL_VERSION}-linux-amd64.tar.gz | tar xz && \
28+
mv doctl /usr/local/bin/doctl && \
29+
chmod +x /usr/local/bin/doctl
30+
31+
# Cleanup
32+
RUN apk del .build-deps && \
33+
rm -rf /tmp/* /var/cache/apk/*
34+
35+
WORKDIR /app
36+
37+
COPY entrypoint.sh /usr/local/bin/
38+
39+
ENTRYPOINT ["entrypoint.sh"]

full/entrypoint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ -n "${TF_TOKEN}" ] ; then
5+
cat > "${HOME}/.terraformrc" <<EOF
6+
credentials "${TF_HOSTNAME}" {
7+
token = "${TF_TOKEN}"
8+
}
9+
10+
EOF
11+
fi
12+
13+
exec "$@"

terraform-aws/Dockerfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
FROM alpine:3.11
2+
3+
ENV TF_TOKEN=""
4+
ENV TF_HOSTNAME="app.terraform.io"
5+
6+
ARG GLIBC_VERSION=2.31-r0
7+
ARG TERRAFORM_VERSION=0.13.1
8+
ARG AWS_IAM_AUTH_VERSION=0.5.1
9+
10+
WORKDIR /tmp
11+
12+
RUN apk add --update --no-cache --virtual .build-deps curl ca-certificates
13+
14+
# Install terraform
15+
RUN curl -L https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -o terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
16+
unzip terraform_${TERRAFORM_VERSION}_linux_amd64.zip && \
17+
mv terraform /usr/local/bin && \
18+
rm terraform_${TERRAFORM_VERSION}_linux_amd64.zip
19+
20+
# Install aws-iam-authenticator (latest version)
21+
RUN curl -L https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/download/v${AWS_IAM_AUTH_VERSION}/aws-iam-authenticator_${AWS_IAM_AUTH_VERSION}_linux_amd64 \
22+
-o /usr/local/bin/aws-iam-authenticator && \
23+
chmod +x /usr/local/bin/aws-iam-authenticator
24+
25+
# Install awscli
26+
RUN apk --no-cache add binutils && \
27+
curl -sL https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub && \
28+
curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-${GLIBC_VERSION}.apk && \
29+
curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VERSION}/glibc-bin-${GLIBC_VERSION}.apk && \
30+
apk add --no-cache glibc-${GLIBC_VERSION}.apk glibc-bin-${GLIBC_VERSION}.apk
31+
32+
RUN curl -L https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip && \
33+
unzip awscliv2.zip && \
34+
./aws/install
35+
36+
# Cleanup
37+
RUN apk del .build-deps && \
38+
rm -rf /tmp/* /var/cache/apk/*
39+
40+
WORKDIR /app
41+
42+
COPY entrypoint.sh /usr/local/bin/
43+
44+
ENTRYPOINT ["entrypoint.sh"]

terraform-aws/entrypoint.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
set -e
3+
4+
if [ -n "${TF_TOKEN}" ] ; then
5+
cat > "${HOME}/.terraformrc" <<EOF
6+
credentials "${TF_HOSTNAME}" {
7+
token = "${TF_TOKEN}"
8+
}
9+
10+
EOF
11+
fi
12+
13+
exec "$@"

0 commit comments

Comments
 (0)