Skip to content

Commit 758989b

Browse files
authored
Merge pull request #2 from devopscorner/develop
Develop
2 parents c12fe31 + 1234188 commit 758989b

File tree

5 files changed

+127
-18
lines changed

5 files changed

+127
-18
lines changed

Dockerfile

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
### Builder ###
2-
FROM golang:1.19.5-alpine3.17 as builder
1+
### Builder Go ###
2+
FROM golang:1.19.5-alpine3.17 as builder-go
33

44
WORKDIR /go/src/app
55
ENV GIN_MODE=release
@@ -18,6 +18,31 @@ RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
1818
cd /go/src/app && \
1919
go build -mod=readonly -ldflags="-s -w" -o goapp
2020

21+
22+
### Builder Python ###
23+
FROM python:3.10.10-alpine${ALPINE_VERSION:-3.17} as builder-python
24+
25+
ARG AWS_CLI_VERSION=2.11.0
26+
RUN apk add --no-cache git unzip groff build-base libffi-dev cmake
27+
RUN git clone --single-branch --depth 1 -b ${AWS_CLI_VERSION} https://github.com/aws/aws-cli.git
28+
29+
WORKDIR aws-cli
30+
RUN python -m venv venv
31+
RUN . venv/bin/activate
32+
RUN scripts/installers/make-exe
33+
RUN unzip -q dist/awscli-exe.zip
34+
RUN aws/install --bin-dir /aws-cli-bin
35+
RUN /aws-cli-bin/aws --version
36+
37+
# reduce image size: remove autocomplete and examples
38+
RUN rm -rf \
39+
/usr/local/aws-cli/v2/current/dist/aws_completer \
40+
/usr/local/aws-cli/v2/current/dist/awscli/data/ac.index \
41+
/usr/local/aws-cli/v2/current/dist/awscli/examples
42+
RUN find /usr/local/aws-cli/v2/current/dist/awscli/data -name completions-1*.json -delete
43+
RUN find /usr/local/aws-cli/v2/current/dist/awscli/botocore/data -name examples-1.json -delete
44+
45+
2146
### Binary ###
2247
# FROM golang:1.19.5-alpine3.17
2348
FROM nginx:${NGINX_VERSION:-1.23-alpine}
@@ -59,8 +84,10 @@ LABEL maintainer="$AUTHOR" \
5984
fr.hbis.docker.base.version="$BUILD_VERSION"
6085

6186
ENV GIN_MODE=release
62-
COPY --from=devopscorner/cicd:alpine /usr/local/bin/ /usr/local/bin/
63-
COPY --from=builder /go/src/app/goapp /usr/local/bin/k8s-context
87+
COPY --from=alpine/k8s:1.26.2 /usr/bin/ /usr/local/bin/
88+
COPY --from=builder-python /usr/local/aws-cli/ /usr/local/aws-cli/
89+
COPY --from=builder-python /aws-cli-bin/ /usr/local/bin/
90+
COPY --from=builder-go /go/src/app/goapp /usr/local/bin/k8s-context
6491

6592
EXPOSE 22 80 443
6693

Dockerfile.alpine-3.15

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
### Builder ###
2-
FROM golang:1.19.3-alpine3.15 as builder
1+
### Builder Go ###
2+
FROM golang:1.19.3-alpine3.15 as builder-go
33

44
WORKDIR /go/src/app
55
ENV GIN_MODE=release
@@ -18,6 +18,31 @@ RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
1818
cd /go/src/app && \
1919
go build -mod=readonly -ldflags="-s -w" -o goapp
2020

21+
22+
### Builder Python ###
23+
FROM python:3.10.10-alpine${ALPINE_VERSION:-3.16} as builder-python
24+
25+
ARG AWS_CLI_VERSION=2.11.0
26+
RUN apk add --no-cache git unzip groff build-base libffi-dev cmake
27+
RUN git clone --single-branch --depth 1 -b ${AWS_CLI_VERSION} https://github.com/aws/aws-cli.git
28+
29+
WORKDIR aws-cli
30+
RUN python -m venv venv
31+
RUN . venv/bin/activate
32+
RUN scripts/installers/make-exe
33+
RUN unzip -q dist/awscli-exe.zip
34+
RUN aws/install --bin-dir /aws-cli-bin
35+
RUN /aws-cli-bin/aws --version
36+
37+
# reduce image size: remove autocomplete and examples
38+
RUN rm -rf \
39+
/usr/local/aws-cli/v2/current/dist/aws_completer \
40+
/usr/local/aws-cli/v2/current/dist/awscli/data/ac.index \
41+
/usr/local/aws-cli/v2/current/dist/awscli/examples
42+
RUN find /usr/local/aws-cli/v2/current/dist/awscli/data -name completions-1*.json -delete
43+
RUN find /usr/local/aws-cli/v2/current/dist/awscli/botocore/data -name examples-1.json -delete
44+
45+
2146
### Binary ###
2247
# FROM golang:1.19.3-alpine3.15
2348
FROM nginx:${NGINX_VERSION:-1.23-alpine}
@@ -59,8 +84,10 @@ LABEL maintainer="$AUTHOR" \
5984
fr.hbis.docker.base.version="$BUILD_VERSION"
6085

6186
ENV GIN_MODE=release
62-
COPY --from=devopscorner/cicd:alpine /usr/local/bin/ /usr/local/bin/
63-
COPY --from=builder /go/src/app/goapp /usr/local/bin/k8s-context
87+
COPY --from=alpine/k8s:1.26.2 /usr/bin/ /usr/local/bin/
88+
COPY --from=builder-python /usr/local/aws-cli/ /usr/local/aws-cli/
89+
COPY --from=builder-python /aws-cli-bin/ /usr/local/bin/
90+
COPY --from=builder-go /go/src/app/goapp /usr/local/bin/k8s-context
6491

6592
EXPOSE 22 80 443
6693

Dockerfile.alpine-3.16

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
### Builder ###
2-
FROM golang:1.19.5-alpine3.16 as builder
1+
### Builder Go ###
2+
FROM golang:1.19.5-alpine3.16 as builder-go
33

44
WORKDIR /go/src/app
55
ENV GIN_MODE=release
@@ -18,6 +18,31 @@ RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
1818
cd /go/src/app && \
1919
go build -mod=readonly -ldflags="-s -w" -o goapp
2020

21+
22+
### Builder Python ###
23+
FROM python:3.10.10-alpine${ALPINE_VERSION:-3.16} as builder-python
24+
25+
ARG AWS_CLI_VERSION=2.11.0
26+
RUN apk add --no-cache git unzip groff build-base libffi-dev cmake
27+
RUN git clone --single-branch --depth 1 -b ${AWS_CLI_VERSION} https://github.com/aws/aws-cli.git
28+
29+
WORKDIR aws-cli
30+
RUN python -m venv venv
31+
RUN . venv/bin/activate
32+
RUN scripts/installers/make-exe
33+
RUN unzip -q dist/awscli-exe.zip
34+
RUN aws/install --bin-dir /aws-cli-bin
35+
RUN /aws-cli-bin/aws --version
36+
37+
# reduce image size: remove autocomplete and examples
38+
RUN rm -rf \
39+
/usr/local/aws-cli/v2/current/dist/aws_completer \
40+
/usr/local/aws-cli/v2/current/dist/awscli/data/ac.index \
41+
/usr/local/aws-cli/v2/current/dist/awscli/examples
42+
RUN find /usr/local/aws-cli/v2/current/dist/awscli/data -name completions-1*.json -delete
43+
RUN find /usr/local/aws-cli/v2/current/dist/awscli/botocore/data -name examples-1.json -delete
44+
45+
2146
### Binary ###
2247
# FROM golang:1.19.5-alpine3.16
2348
FROM nginx:${NGINX_VERSION:-1.23-alpine}
@@ -59,8 +84,10 @@ LABEL maintainer="$AUTHOR" \
5984
fr.hbis.docker.base.version="$BUILD_VERSION"
6085

6186
ENV GIN_MODE=release
62-
COPY --from=devopscorner/cicd:alpine /usr/local/bin/ /usr/local/bin/
63-
COPY --from=builder /go/src/app/goapp /usr/local/bin/k8s-context
87+
COPY --from=alpine/k8s:1.26.2 /usr/bin/ /usr/local/bin/
88+
COPY --from=builder-python /usr/local/aws-cli/ /usr/local/aws-cli/
89+
COPY --from=builder-python /aws-cli-bin/ /usr/local/bin/
90+
COPY --from=builder-go /go/src/app/goapp /usr/local/bin/k8s-context
6491

6592
EXPOSE 22 80 443
6693

Dockerfile.alpine-3.17

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
### Builder ###
2-
FROM golang:1.19.5-alpine3.17 as builder
1+
### Builder Go ###
2+
FROM golang:1.19.5-alpine3.17 as builder-go
33

44
WORKDIR /go/src/app
55
ENV GIN_MODE=release
@@ -18,6 +18,31 @@ RUN GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
1818
cd /go/src/app && \
1919
go build -mod=readonly -ldflags="-s -w" -o goapp
2020

21+
22+
### Builder Python ###
23+
FROM python:3.10.10-alpine${ALPINE_VERSION:-3.17} as builder-python
24+
25+
ARG AWS_CLI_VERSION=2.11.0
26+
RUN apk add --no-cache git unzip groff build-base libffi-dev cmake
27+
RUN git clone --single-branch --depth 1 -b ${AWS_CLI_VERSION} https://github.com/aws/aws-cli.git
28+
29+
WORKDIR aws-cli
30+
RUN python -m venv venv
31+
RUN . venv/bin/activate
32+
RUN scripts/installers/make-exe
33+
RUN unzip -q dist/awscli-exe.zip
34+
RUN aws/install --bin-dir /aws-cli-bin
35+
RUN /aws-cli-bin/aws --version
36+
37+
# reduce image size: remove autocomplete and examples
38+
RUN rm -rf \
39+
/usr/local/aws-cli/v2/current/dist/aws_completer \
40+
/usr/local/aws-cli/v2/current/dist/awscli/data/ac.index \
41+
/usr/local/aws-cli/v2/current/dist/awscli/examples
42+
RUN find /usr/local/aws-cli/v2/current/dist/awscli/data -name completions-1*.json -delete
43+
RUN find /usr/local/aws-cli/v2/current/dist/awscli/botocore/data -name examples-1.json -delete
44+
45+
2146
### Binary ###
2247
# FROM golang:1.19.5-alpine3.17
2348
FROM nginx:${NGINX_VERSION:-1.23-alpine}
@@ -59,8 +84,10 @@ LABEL maintainer="$AUTHOR" \
5984
fr.hbis.docker.base.version="$BUILD_VERSION"
6085

6186
ENV GIN_MODE=release
62-
COPY --from=devopscorner/cicd:alpine /usr/local/bin/ /usr/local/bin/
63-
COPY --from=builder /go/src/app/goapp /usr/local/bin/k8s-context
87+
COPY --from=alpine/k8s:1.26.2 /usr/bin/ /usr/local/bin/
88+
COPY --from=builder-python /usr/local/aws-cli/ /usr/local/aws-cli/
89+
COPY --from=builder-python /aws-cli-bin/ /usr/local/bin/
90+
COPY --from=builder-go /go/src/app/goapp /usr/local/bin/k8s-context
6491

6592
EXPOSE 22 80 443
6693

docker-compose.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ networks:
99
driver: bridge
1010
ipam:
1111
config:
12-
- subnet: 172.148.148.0/16
12+
- subnet: 172.148.0.0/16
1313

1414
#================================================================================================
1515
# VOLUME SETUP
@@ -57,10 +57,11 @@ services:
5757
build:
5858
context: .
5959
dockerfile: Dockerfile
60+
# image: devopscorner/k8s-context:alpine
6061
container_name: ${CONTAINER_K8S_CONTEXT:-devopscorner_k8s_context}
6162
restart: unless-stopped
6263
ports:
63-
- "${PORT_K8S_CONTEXT:-8080}:8080"
64+
- "${PORT_K8S_CONTEXT:-8080}:80"
6465
volumes:
6566
# - /etc/localtime:/etc/localtime:ro ## Do not use it in mac
6667
- /var/run/docker.sock:/var/run/docker.sock ## Do not use it in k8s

0 commit comments

Comments
 (0)