Add pre-commit and cosign
This commit is contained in:
7
Makefile
Normal file
7
Makefile
Normal file
@@ -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
|
||||||
23
README.md
23
README.md
@@ -15,6 +15,8 @@ DevOps Portable toolkit
|
|||||||
- yq
|
- yq
|
||||||
- k6
|
- k6
|
||||||
- s3fs
|
- s3fs
|
||||||
|
- pre-commit
|
||||||
|
- cosign
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '3.7'
|
version: '3.7'
|
||||||
@@ -27,24 +29,3 @@ services:
|
|||||||
- ~/.kube:/root/.kube
|
- ~/.kube:/root/.kube
|
||||||
- ~/.ssh:/root/.ssh # If you use private CVS
|
- ~/.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
|
|
||||||
```
|
|
||||||
6
build.sh
6
build.sh
@@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
docker build -f src/Dockerfile -t jkaninda/toolkit:latest .
|
|
||||||
|
|
||||||
docker compose up -d
|
|
||||||
|
|
||||||
@@ -1,52 +1,61 @@
|
|||||||
|
FROM gcr.io/projectsigstore/cosign:v2.2.4 as cosign-bin
|
||||||
|
|
||||||
FROM ubuntu:22.04
|
FROM ubuntu:22.04
|
||||||
ENV BUCKETNAME=""
|
ENV BUCKETNAME=""
|
||||||
ENV ACCESS_KEY=""
|
ENV ACCESS_KEY=""
|
||||||
ENV SECRET_KEY=""
|
ENV SECRET_KEY=""
|
||||||
ENV S3_ENDPOINT=https://s3.amazonaws.com
|
ENV S3_ENDPOINT=https://s3.amazonaws.com
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
ENV VERSION="0.1"
|
ENV VERSION="0.2"
|
||||||
ARG TEMP_DIR=/temp
|
ARG TEMP_DIR=/temp
|
||||||
|
LABEL auth="Jonas Kaninda"
|
||||||
|
LABEL github="https://github.com/jkaninda/toolkit"
|
||||||
RUN apt-get update -qq \
|
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 -
|
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 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
|
# Clear cache
|
||||||
RUN apt-get clean && rm -rf /var/lib/apt/lists/*
|
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
|
## 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 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 mv k6 /usr/local/bin/
|
||||||
RUN chmod +x /usr/local/bin/k6
|
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 curl -s "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash
|
||||||
RUN mv kustomize /usr/local/bin/kustomize
|
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 curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
|
||||||
RUN chmod 700 get_helm.sh
|
RUN chmod 700 get_helm.sh
|
||||||
RUN ./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 curl -LO https://dl.k8s.io/release/v1.29.0/bin/linux/amd64/kubectl
|
||||||
RUN chmod +x kubectl
|
RUN chmod +x kubectl
|
||||||
RUN mv kubectl /usr/local/bin/kubectl
|
RUN mv kubectl /usr/local/bin/kubectl
|
||||||
|
RUN ln -s /usr/local/bin/kubectl /usr/local/bin/k
|
||||||
RUN mkdir $TEMP_DIR && \
|
RUN mkdir -p $TEMP_DIR && \
|
||||||
chmod 777 $TEMP_DIR && \
|
chmod 777 $TEMP_DIR && \
|
||||||
mkdir $TEMP_DIR/s3cache && \
|
mkdir -p $TEMP_DIR/s3cache && \
|
||||||
chmod 777 $TEMP_DIR/s3cache
|
chmod 777 $TEMP_DIR/s3cache
|
||||||
|
## Copy scripts
|
||||||
COPY src/scripts/backup.sh /usr/local/bin/
|
COPY src/scripts/backup.sh /usr/local/bin/
|
||||||
RUN chmod +x /usr/local/bin/backup.sh
|
RUN chmod +x /usr/local/bin/backup.sh
|
||||||
COPY src/scripts/s3-mount.sh /usr/local/bin/
|
COPY src/scripts/s3-mount.sh /usr/local/bin/
|
||||||
RUN chmod +x /usr/local/bin/s3-mount.sh
|
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/s3-mount.sh /usr/local/bin/s3-mount
|
||||||
RUN ln -s /usr/local/bin/backup.sh /usr/local/bin/backup
|
RUN ln -s /usr/local/bin/backup.sh /usr/local/bin/backup
|
||||||
|
|
||||||
ADD src/supervisord.conf /etc/supervisor/supervisord.conf
|
ADD src/supervisord.conf /etc/supervisor/supervisord.conf
|
||||||
|
|
||||||
CMD ["/usr/bin/supervisord"]
|
CMD ["/usr/bin/supervisord"]
|
||||||
Reference in New Issue
Block a user