From e9d07654727ea47b18a4b5a88f2704b957ce402a Mon Sep 17 00:00:00 2001 From: amandinemart1 Date: Fri, 20 Dec 2024 14:09:37 +0100 Subject: [PATCH 1/4] addition Dockerfile --- Dockerimage/Dockerfile | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Dockerimage/Dockerfile diff --git a/Dockerimage/Dockerfile b/Dockerimage/Dockerfile new file mode 100644 index 0000000..0ce3eea --- /dev/null +++ b/Dockerimage/Dockerfile @@ -0,0 +1,12 @@ +FROM python:3.9-slim + +# Install Sublist3r +RUN apt-get update && apt-get install -y git +RUN git clone https://github.com/aboul3la/Sublist3r.git +RUN pip install -r Sublist3r/requirements.txt + +# Make port 80 available to the world outside this container +EXPOSE 80 + +# Run Sublist3r when the container launches +ENTRYPOINT [ "sh", "-c", "python", "Sublist3r/sublist3r.py" ] \ No newline at end of file From 2d0fed0f2eafe0b61a13db0aa28f443d58363ee8 Mon Sep 17 00:00:00 2001 From: Ozeliurs Date: Fri, 20 Dec 2024 14:13:13 +0100 Subject: [PATCH 2/4] feat(ci): add GitHub Actions workflow for building and pushing Docker image to GitHub Container Registry --- .github/workflows/docker-build-push.yaml | 48 ++++++++++++++++++++++++ Dockerimage/Dockerfile => Dockerfile | 22 +++++------ 2 files changed, 59 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/docker-build-push.yaml rename Dockerimage/Dockerfile => Dockerfile (81%) diff --git a/.github/workflows/docker-build-push.yaml b/.github/workflows/docker-build-push.yaml new file mode 100644 index 0000000..2c24535 --- /dev/null +++ b/.github/workflows/docker-build-push.yaml @@ -0,0 +1,48 @@ +name: Build and Push Docker Image + +on: + push: + branches: + - master + +permissions: + contents: read + packages: write + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/sublist3r + tags: | + latest + type=ref,event=branch + type=sha + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: Dockerfile + push: true + platforms: linux/amd64,linux/arm64 + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerimage/Dockerfile b/Dockerfile similarity index 81% rename from Dockerimage/Dockerfile rename to Dockerfile index 0ce3eea..523e917 100644 --- a/Dockerimage/Dockerfile +++ b/Dockerfile @@ -1,12 +1,12 @@ -FROM python:3.9-slim - -# Install Sublist3r -RUN apt-get update && apt-get install -y git -RUN git clone https://github.com/aboul3la/Sublist3r.git -RUN pip install -r Sublist3r/requirements.txt - -# Make port 80 available to the world outside this container -EXPOSE 80 - -# Run Sublist3r when the container launches +FROM python:3.9-slim + +# Install Sublist3r +RUN apt-get update && apt-get install -y git +RUN git clone https://github.com/aboul3la/Sublist3r.git +RUN pip install -r Sublist3r/requirements.txt + +# Make port 80 available to the world outside this container +EXPOSE 80 + +# Run Sublist3r when the container launches ENTRYPOINT [ "sh", "-c", "python", "Sublist3r/sublist3r.py" ] \ No newline at end of file From cd2be6a2d322656033041ff723f4dc41b06b143e Mon Sep 17 00:00:00 2001 From: Ozeliurs Date: Fri, 20 Dec 2024 14:55:41 +0100 Subject: [PATCH 3/4] refactor(Dockerfile): replace ENTRYPOINT with CMD to allow for easier command override --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 523e917..073a4a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM python:3.9-slim # Install Sublist3r -RUN apt-get update && apt-get install -y git +RUN apt-get update && apt-get install -y git RUN git clone https://github.com/aboul3la/Sublist3r.git RUN pip install -r Sublist3r/requirements.txt @@ -9,4 +9,4 @@ RUN pip install -r Sublist3r/requirements.txt EXPOSE 80 # Run Sublist3r when the container launches -ENTRYPOINT [ "sh", "-c", "python", "Sublist3r/sublist3r.py" ] \ No newline at end of file +CMD [ "python", "Sublist3r/sublist3r.py" ] From 27933a193c65f213491764c44e38e326fa740111 Mon Sep 17 00:00:00 2001 From: Ozeliurs Date: Fri, 20 Dec 2024 15:00:03 +0100 Subject: [PATCH 4/4] fix(Dockerfile): update command to use ENTRYPOINT instead of CMD for a more predictable container startup behavior --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 073a4a6..7491d3d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,4 +9,4 @@ RUN pip install -r Sublist3r/requirements.txt EXPOSE 80 # Run Sublist3r when the container launches -CMD [ "python", "Sublist3r/sublist3r.py" ] +ENTRYPOINT [ "python3", "Sublist3r/sublist3r.py" ]