diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml deleted file mode 100644 index 97968a5..0000000 --- a/.github/workflows/docker-build.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: sealedsecret - -on: - - push - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Get Latest Tag - id: latest_tag - run: echo "::set-output name=tag::$(git describe --abbrev=0 --tags)" - - - name: Display Latest Tags - run: echo "Latest tag is ${{ steps.latest_tag.outputs.tag }}" diff --git a/.github/workflows/mongo.yml b/.github/workflows/mongo.yml new file mode 100644 index 0000000..0261675 --- /dev/null +++ b/.github/workflows/mongo.yml @@ -0,0 +1,43 @@ +name: Build mongodb backup + +on: + pull_request: + branches: [ "*" ] + paths: 'mongodb-backup/**' + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Generate container metadata + id: meta + uses: docker/metadata-action@v3 + with: + images: ghcr.io/deepak7340/mongodb-backup + tags: | + type=ref,event=branch,enable=${{ !endsWith(github.ref, github.event.repository.default_branch) }} + type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} + type=ref,event=tag + flavor: | + latest=false + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build & push container image + id: docker_build + uses: docker/build-push-action@v2 + with: + file: "./mongodb-backup/Dockerfile" + context: . + labels: ${{ steps.meta.outputs.labels }} + push: true + tags: ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/mongodump-build.yml b/.github/workflows/mongodump-build.yml deleted file mode 100644 index bc79442..0000000 --- a/.github/workflows/mongodump-build.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Build & publish mongodump images - -on: - workflow_run: - workflows: - - "mongodump" - types: - - completed - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - dockerfile: ./mongodb-backup/Dockerfile - image: ghcr.io/deepak7340/mongodbbackup - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Get Latest Tag - id: latest_tag - run: echo "::set-output name=tag::$(git describe --abbrev=0 --tags)" - - - name: Docker Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} # github username or org - password: ${{ secrets.GITHUB_TOKEN }} # github actions builtin token. repo has to have pkg access. - - - name: Extract metadata (tags, labels) for image - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ matrix.image }} - - - name: Build and push image - env: - TAG: ${{ steps.latest_tag.outputs.tag }} - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - file: ${{ matrix.dockerfile }} - push: true - labels: ${{ steps.meta.outputs.labels }} - build-args: | - TAG=${TAG} - tags: ghcr.io/deepak7340/mongodb-backup:${{ env.TAG }} diff --git a/.github/workflows/sealed-secret-build.yml b/.github/workflows/sealed-secret-build.yml deleted file mode 100644 index 2989a4e..0000000 --- a/.github/workflows/sealed-secret-build.yml +++ /dev/null @@ -1,61 +0,0 @@ -name: Build & publish images - -on: - workflow_run: - workflows: - - "sealedsecret" - types: - - completed - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-and-push-image: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - dockerfile: ./backup-sealed-secrets-keys/Dockerfile - image: ghcr.io/deepak7340/backup-sealed-secrets-keys - permissions: - contents: read - packages: write - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Get Latest Tag - id: latest_tag - run: echo "::set-output name=tag::$(git describe --abbrev=0 --tags)" - - - name: Docker Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} # github username or org - password: ${{ secrets.GITHUB_TOKEN }} # github actions builtin token. repo has to have pkg access. - - - name: Extract metadata (tags, labels) for image - id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 - with: - images: ${{ matrix.image }} - - - name: Build and push image - env: - TAG: ${{ steps.latest_tag.outputs.tag }} - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc - with: - context: . - file: ${{ matrix.dockerfile }} - push: true - labels: ${{ steps.meta.outputs.labels }} - build-args: | - TAG=${TAG} - tags: ghcr.io/deepak7340/backup-sealed-secrets-keys:${{ env.TAG }} diff --git a/.github/workflows/sealed.yml b/.github/workflows/sealed.yml new file mode 100644 index 0000000..7c90868 --- /dev/null +++ b/.github/workflows/sealed.yml @@ -0,0 +1,43 @@ +name: Build backup-sealed-secrets-keys + +on: + pull_request: + branches: [ "*" ] + paths: 'backup-sealed-secrets-keys/**' + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Generate container metadata + id: meta + uses: docker/metadata-action@v3 + with: + images: ghcr.io/deepak7340/backup-sealed-secrets-keys + tags: | + type=ref,event=branch,enable=${{ !endsWith(github.ref, github.event.repository.default_branch) }} + type=raw,value=latest,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }} + type=ref,event=tag + flavor: | + latest=false + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build & push container image + id: docker_build + uses: docker/build-push-action@v2 + with: + file: "./backup-sealed-secrets-keys/Dockerfile" + context: . + labels: ${{ steps.meta.outputs.labels }} + push: true + tags: ${{ steps.meta.outputs.tags }} diff --git a/mongodb-backup/Dockerfile b/mongodb-backup/Dockerfile index feb9862..19aa17e 100644 --- a/mongodb-backup/Dockerfile +++ b/mongodb-backup/Dockerfile @@ -1,25 +1,25 @@ FROM ubuntu:22.04@sha256:965fbcae990b0467ed5657caceaec165018ef44a4d2d46c7cdea80a9dff0d1ea -RUN apt-get -y update && apt-get -y install --no-install-recommends python3 python3-pymongo curl wget awscli gcc musl-dev python3-dev libffi-dev cargo make pip +#RUN apt-get -y update && apt-get -y install --no-install-recommends python3 python3-pymongo curl wget awscli gcc musl-dev python3-dev libffi-dev cargo make pip -RUN wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.6.1.deb -O /tmp/mongodb-tools.deb && \ - dpkg -i /tmp/mongodb-tools.deb && \ - rm /tmp/mongodb-tools.deb +#RUN wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2204-x86_64-100.6.1.deb -O /tmp/mongodb-tools.deb && \ +# dpkg -i /tmp/mongodb-tools.deb && \ +# rm /tmp/mongodb-tools.deb -RUN pip install --upgrade pip -RUN pip install azure-cli -RUN mkdir /backup +#RUN pip install --upgrade pip +#RUN pip install azure-cli +RUN mkdir /backup /tiw -ENV S3_PATH=mongodb AWS_DEFAULT_REGION=us-east-1 +#ENV S3_PATH=mongodb AWS_DEFAULT_REGION=us-east-1 -COPY ./mongodb-backup/script/entrypoint.sh /usr/local/bin/entrypoint -COPY ./mongodb-backup/script/backup.sh /usr/local/bin/backup -COPY ./mongodb-backup/script/mongouri.py /usr/local/bin/mongouri +#COPY ./mongodb-backup/script/entrypoint.sh /usr/local/bin/entrypoint +#COPY ./mongodb-backup/script/backup.sh /usr/local/bin/backup +#COPY ./mongodb-backup/script/mongouri.py /usr/local/bin/mongouri -RUN chmod 775 /usr/local/bin/entrypoint -RUN chmod 775 /usr/local/bin/backup -RUN chmod 775 /usr/local/bin/mongouri +#RUN chmod 775 /usr/local/bin/entrypoint +#RUN chmod 775 /usr/local/bin/backup +#RUN chmod 775 /usr/local/bin/mongouri -VOLUME /backup +#VOLUME /backup -CMD /usr/local/bin/entrypoint +#CMD /usr/local/bin/entrypoint