diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index 8a2ed91..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Docker Image CI - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - name: Build & Push to Docker Hub - uses: opspresso/action-docker@master - env: - USERNAME: ${{ secrets.DOCKER_USERNAME }} - PASSWORD: ${{ secrets.DOCKER_PASSWORD }} - IMAGE_NAME: "jdharrington/toolbox" - TAG_NAME: ${{ env.GITHUB_SHA }} - LATEST: "true" diff --git a/.github/workflows/upload.yml b/.github/workflows/upload.yml new file mode 100644 index 0000000..83c7643 --- /dev/null +++ b/.github/workflows/upload.yml @@ -0,0 +1,49 @@ +name: Docker Image CI + +on: [push] + +env: + ECR_REPOSITORY: toolbox +jobs: + upload-docker-image: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.TRUSS_AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.TRUSS_AWS_SECRET_ACCESS_KEY }} + aws-region: us-east-2 + + - name: Login to AWS ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Create ECR repository if not exists + uses: int128/create-ecr-repository-action@v1 + id: ecr + with: + repository: ${{ env.ECR_REPOSITORY }} + + - name: Build Docker image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }} + IMAGE_TAG: ${{ github.sha }} + run: | + docker build \ + -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + + + - name: Push Docker image to AWS ECR + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }} + IMAGE_TAG: ${{ github.sha }} + run: | + docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest diff --git a/Dockerfile b/Dockerfile index b8715ea..c7627d2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,23 +7,20 @@ RUN apk add --update \ && rm -rf /var/cache/apk/* # HashiCorp Vault -COPY --from=vault:latest /bin/vault /usr/bin/vault +COPY --from=hashicorp/vault:latest /bin/vault /usr/bin/vault ENV VAULT_ADDR https://vault.vault.svc:8200 ENV VAULT_SKIP_VERIFY true -# HashiCorp Consul -COPY --from=consul:latest /bin/consul /usr/bin/consul -ENV CONSUL_HTTP_ADDR http://consul.vault.svc:8500 - # kubectl -COPY --from=bitnami/kubectl:1.15-ol-7 /opt/bitnami/kubectl/bin/kubectl /usr/bin/kubectl +COPY --from=bitnami/kubectl:1.33.2 /opt/bitnami/kubectl/bin/kubectl /usr/bin/kubectl # AWS CLI -RUN /usr/bin/easy_install-3.8 pip && pip install awscli +RUN apk add --no-cache aws-cli -# Scuttle -COPY --from=redboxoss/scuttle:latest /scuttle /usr/bin/scuttle +# add only redis cli from redis suite +COPY --from=redis:7-alpine /usr/local/bin/redis-cli /usr/local/bin/redis-cli +RUN chmod +x /usr/local/bin/redis-cli COPY motd /etc/motd COPY entrypoint.sh ./ diff --git a/Makefile b/Makefile index 06151cd..86bcd9b 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ build: - docker build -t jdharrington/toolbox:latest . + docker build -t 127178877223.dkr.ecr.us-east-2.amazonaws.com/toolbox:latest . push: - docker push jdharrington/toolbox:latest + docker push 127178877223.dkr.ecr.us-east-2.amazonaws.com/toolbox:latest diff --git a/entrypoint.sh b/entrypoint.sh index 6a08c01..44ea4a8 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,16 +2,8 @@ set -e -export ENVOY_ADMIN_API="http://127.0.0.1:15000" -export ISTIO_QUIT_API="http://127.0.0.1:15020" -export START_WITHOUT_ENVOY="true" - -if [ "${ISTIO_ENABLED}" = "true" ]; then - export SCUTTLE_CMD=/usr/bin/scuttle -fi - if [ "${1}" = "" ]; then - exec ${SCUTTLE_CMD} /bin/bash -l + exec /bin/bash -l else - exec ${SCUTTLE_CMD} "$@" + exec "$@" fi