-
Notifications
You must be signed in to change notification settings - Fork 16
feat: Adding Dockerfile for stats and CI for building container images #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 10 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
c99a1c4
feat: Adding CI for building Docker images
malteos 370eca0
fixed ci
malteos 3d99423
removed install r package
malteos 408bded
fixed ci
malteos 7a3cf3e
Added pytest as a dependency
malteos a0ed3ef
Added missing dependencies
malteos 2643c0a
Merge branch 'master' into feat/docker-ci
malteos cd2839e
running container workflow on plots
malteos 0a65a37
fixed CI image tag
malteos 35b78ab
CI image push not for forks
malteos 3f0f10b
Set white background explicitly
malteos d3aa8d8
Set theme kwargs
malteos e0af64e
increased font size
malteos 650f127
force colors
malteos edc8e1e
update font family
malteos 4aa3744
update font size
malteos cc11aed
increased line width
malteos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| name: CI Pipeline | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
| IMAGE_NAME: ${{ github.repository }} | ||
|
|
||
| jobs: | ||
| test-and-build-stats: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Log in to Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Extract metadata for stats image | ||
| id: meta-stats | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/stats | ||
| tags: | | ||
| type=ref,event=branch | ||
| type=ref,event=pr | ||
| type=sha | ||
| type=raw,value=latest,enable={{is_default_branch}} | ||
|
|
||
| - name: Build stats Docker image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: ./stats.Dockerfile | ||
| push: false | ||
| tags: | | ||
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/stats:${{ github.sha }} | ||
| ${{ steps.meta-stats.outputs.tags }} | ||
| labels: ${{ steps.meta-stats.outputs.labels }} | ||
|
|
||
| - name: Run unit tests | ||
| run: | | ||
| docker run --rm \ | ||
| -v ${{ github.workspace }}/tests:/app/tests \ | ||
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/stats:${{ github.sha }} \ | ||
| python -m pytest -s tests/ | ||
|
|
||
| - name: Push stats Docker image | ||
| if: success() && github.event.pull_request.head.repo.full_name == github.repository | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: ./stats.Dockerfile | ||
| push: true | ||
| tags: ${{ steps.meta-stats.outputs.tags }} | ||
| labels: ${{ steps.meta-stats.outputs.labels }} | ||
|
|
||
| build-site: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Log in to Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY }} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Extract metadata for site image | ||
| id: meta-site | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/site | ||
| tags: | | ||
| type=ref,event=branch | ||
| type=ref,event=pr | ||
| type=sha | ||
| type=raw,value=latest,enable={{is_default_branch}} | ||
|
|
||
| - name: Build and push site Docker image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| file: ./site.Dockerfile | ||
| push: ${{ github.event.pull_request.head.repo.full_name == github.repository }} | ||
| tags: ${{ steps.meta-site.outputs.tags }} | ||
| labels: ${{ steps.meta-site.outputs.labels }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| #!/bin/bash | ||
| set -e | ||
|
|
||
| echo "Starting ..." | ||
|
|
||
| ./get_stats.sh | ||
|
|
||
| # make sure plot directories exist | ||
| mkdir -p plots/crawler | ||
| mkdir -p plots/crawloverlap | ||
| mkdir -p plots/crawlsize | ||
| mkdir -p plots/throughput | ||
| mkdir -p plots/tld | ||
|
|
||
| ./plot.sh | ||
|
|
||
| echo "Done." |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,10 @@ | ||
| hyperloglog==0.0.14 | ||
| isoweek | ||
| mrjob | ||
| tldextract | ||
| ujson | ||
| isoweek==1.3.3 | ||
| mrjob==0.7.4 | ||
| tldextract==5.1.2 | ||
| ujson==5.10.0 | ||
|
|
||
| # tests | ||
| pytest | ||
| jsonpickle | ||
| setuptools |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| ggplot | ||
| idna | ||
| pandas | ||
| pygraphviz | ||
| rpy2 | ||
| ggplot==0.11.5 | ||
| idna==3.7 | ||
| #pandas==2.1.4+dfsg | ||
| pandas==2.1.4 | ||
| pygraphviz==1.13 | ||
| rpy2==3.5.15 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Replicating pjox/cc-crawl-statistics | ||
| FROM python:3.12 | ||
|
|
||
| # Install system dependencies | ||
| RUN apt-get update && apt-get install -y \ | ||
| git \ | ||
| python3-rpy2 \ | ||
| r-cran-ggplot2 \ | ||
| graphviz-dev \ | ||
| r-base jq \ | ||
| awscli | ||
|
|
||
| # Set working directory | ||
| WORKDIR /app | ||
|
|
||
| # Copy dependency config files (first for cache) | ||
| COPY requirements.txt . | ||
| COPY requirements_plot.txt . | ||
|
|
||
| # Install Python dependencies | ||
| RUN pip3 install -r requirements.txt | ||
| RUN pip3 install -r requirements_plot.txt | ||
|
|
||
| # Copy the remaining repository files | ||
| COPY stats/crawler ./stats/crawler | ||
| COPY plots/ ./plots/ | ||
| COPY plot/ ./plot/ | ||
| COPY tests/ ./tests/ | ||
|
|
||
| COPY *.sh ./ | ||
| COPY *.py ./ | ||
| COPY _config.yml ./ | ||
|
|
||
| # Set PYTHONPATH environment variable | ||
| ENV PYTHONPATH=/app | ||
|
|
||
| # ggplot2 is already installed via r-cran-ggplot2 system package above | ||
|
|
||
| # Default command | ||
| CMD ["./get_stats_and_plot.sh"] |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.