diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3386315 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +IMAGE_NAME=jkaninda/toolkit + +build: + docker build -f src/Dockerfile -t ${IMAGE_NAME}:latest . + +run: + docker compose up -d --force-recreate \ No newline at end of file diff --git a/README.md b/README.md index 6c8424b..81a6a5d 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ DevOps Portable toolkit - yq - k6 - s3fs +- pre-commit +- cosign ```yaml version: '3.7' @@ -27,24 +29,3 @@ services: - ~/.kube:/root/.kube - ~/.ssh:/root/.ssh # If you use private CVS ``` -## Mount S3 - -> Command : s3-mount - -```yaml -version: '3.7' -services: - toolkit: - image: jkaninda/toolkit:latest - container_name: toolkit - privileged: true - devices: - - "/dev/fuse" - volumes: - - ./custome-volume:/custome-volume - environment: - - ACCESS_KEY=${ACCESS_KEY} - - SECRET_KEY=${SECRET_KEY} - - BUCKETNAME=${BUCKETNAME} - - S3_ENDPOINT=https://s3.us-west-2.amazonaws.com -``` \ No newline at end of file diff --git a/build.sh b/build.sh deleted file mode 100755 index 48ea6c4..0000000 --- a/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - - docker build -f src/Dockerfile -t jkaninda/toolkit:latest . - - docker compose up -d - diff --git a/src/Dockerfile b/src/Dockerfile index c7677ad..a0d145d 100644 --- a/src/Dockerfile +++ b/src/Dockerfile @@ -1,52 +1,61 @@ +FROM gcr.io/projectsigstore/cosign:v2.2.4 as cosign-bin + FROM ubuntu:22.04 ENV BUCKETNAME="" ENV ACCESS_KEY="" ENV SECRET_KEY="" ENV S3_ENDPOINT=https://s3.amazonaws.com ARG DEBIAN_FRONTEND=noninteractive -ENV VERSION="0.1" +ENV VERSION="0.2" ARG TEMP_DIR=/temp +LABEL auth="Jonas Kaninda" +LABEL github="https://github.com/jkaninda/toolkit" RUN apt-get update -qq \ - && apt-get install curl gnupg2 jq git wget supervisor s3fs -y + && apt-get install -qqy curl gnupg2 jq git wget supervisor s3fs python3 python3-pip -y RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add - +WORKDIR /temp RUN curl https://get.docker.com/ > dockerinstall && chmod 777 dockerinstall && ./dockerinstall - - -RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq && chmod +x /usr/bin/yq +RUN wget https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -O /usr/bin/yq &&\ +chmod +x /usr/bin/yq # Clear cache RUN apt-get clean && rm -rf /var/lib/apt/lists/* +## Copy cosign +COPY --from=cosign-bin /ko-app/cosign /usr/local/bin/cosign + +## Install Pre-commit +RUN pip install pre-commit + ## Install K6 RUN curl https://github.com/grafana/k6/releases/download/v0.48.0/k6-v0.48.0-linux-amd64.tar.gz -L | tar xvz --strip-components 1 RUN mv k6 /usr/local/bin/ RUN chmod +x /usr/local/bin/k6 - +## Install kustomize RUN curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash RUN mv kustomize /usr/local/bin/kustomize - +## Install Helm RUN curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 RUN chmod 700 get_helm.sh RUN ./get_helm.sh - +## Install kubectl RUN curl -LO https://dl.k8s.io/release/v1.29.0/bin/linux/amd64/kubectl RUN chmod +x kubectl RUN mv kubectl /usr/local/bin/kubectl - -RUN mkdir $TEMP_DIR && \ +RUN ln -s /usr/local/bin/kubectl /usr/local/bin/k +RUN mkdir -p $TEMP_DIR && \ chmod 777 $TEMP_DIR && \ - mkdir $TEMP_DIR/s3cache && \ + mkdir -p $TEMP_DIR/s3cache && \ chmod 777 $TEMP_DIR/s3cache - +## Copy scripts COPY src/scripts/backup.sh /usr/local/bin/ RUN chmod +x /usr/local/bin/backup.sh COPY src/scripts/s3-mount.sh /usr/local/bin/ RUN chmod +x /usr/local/bin/s3-mount.sh - +## Create link RUN ln -s /usr/local/bin/s3-mount.sh /usr/local/bin/s3-mount RUN ln -s /usr/local/bin/backup.sh /usr/local/bin/backup ADD src/supervisord.conf /etc/supervisor/supervisord.conf - CMD ["/usr/bin/supervisord"] \ No newline at end of file