-
Notifications
You must be signed in to change notification settings - Fork 23
Add docker, docker compose stack #43
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
Open
turnrye
wants to merge
4
commits into
n7tae:master
Choose a base branch
from
turnrye:feat/docker
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
54e813c
chore(dashboard): fix issues that were causing noisy PHP deprecation …
turnrye 3d1a1a5
fix(daemonization): update Makefile to honor the DAEMON flag properly…
turnrye 8d8c7f9
feat(docker): enable running with docker for both mrefd and mrefd-das…
turnrye a1903bf
chore(ci): add github actions for building and publishing for both mr…
turnrye 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,23 @@ | ||
| TZ=America/Chicago | ||
|
|
||
| # Relative paths to the various configuration files | ||
| CONFIG_PATH=./mrefd.cfg | ||
| BLACKLIST_PATH=./mrefd.blacklist | ||
| WHITELIST_PATH=./mrefd.whitelist | ||
| INTERLINK_PATH=./mrefd.interlink | ||
| DASH_CONFIG_PATH=./php-dash/include/config.inc.php | ||
|
|
||
| # Port to bind the services to on the host machine | ||
| HOST_M17_PORT=17000 | ||
| HOST_DHT_PORT=17171 | ||
| HOST_DASHBOARD_PORT=80 | ||
|
|
||
| # Port to bind the services to inside the container | ||
| # These should match the ports in mrefd.cfg | ||
| CONTAINER_M17_PORT=17000 | ||
| CONTAINER_DHT_PORT=17171 | ||
| CONTAINER_DASHBOARD_PORT=80 | ||
|
|
||
| # Path to where DHT file should be stored | ||
| # DHT_PATH=./mrefd.dht.bin | ||
| # TODO uncomment once this is working |
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,63 @@ | ||
| name: Publish mrefd-dash Docker Image to GHCR | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
| REGISTRY_IMAGE: ${{ github.repository_owner }}/mrefd-dash | ||
|
|
||
| on: | ||
| push: | ||
| paths: | ||
| - '.github/workflows/publish-docker-dashboard.yaml' | ||
| - 'php-dash/**' | ||
| branches: | ||
| - "**" | ||
| tags: | ||
| - "v*.*.*" | ||
| pull_request: | ||
| paths: | ||
| - '.github/workflows/publish-docker-dashboard.yaml' | ||
| - 'php-dash/**' | ||
| jobs: | ||
| build-and-publish-dash: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write # Required to push to GHCR | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY}} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Docker meta | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.REGISTRY }}/${{ env.REGISTRY_IMAGE }} | ||
| tags: | | ||
| type=schedule | ||
| type=ref,event=branch | ||
| type=ref,event=pr | ||
| type=semver,pattern={{version}} | ||
| type=semver,pattern={{major}}.{{minor}} | ||
| type=semver,pattern={{major}} | ||
| type=sha | ||
| type=raw,value=latest,enable={{is_default_branch}} | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build and push Docker image for mrefd-dash | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: ./php-dash | ||
| file: ./php-dash/Containerfile | ||
| platforms: linux/amd64,linux/arm64 | ||
| push: ${{ github.event_name != 'pull_request' }} | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: Publish mrefd Docker Image to GHCR | ||
|
|
||
| env: | ||
| REGISTRY: ghcr.io | ||
| REGISTRY_IMAGE: ${{ github.repository_owner }}/mrefd | ||
|
|
||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - "**" | ||
| tags: | ||
| - "v*.*.*" | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| build-and-publish-mrefd: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write # Required to push to GHCR | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Log in to GitHub Container Registry | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: ${{ env.REGISTRY}} | ||
| username: ${{ github.actor }} | ||
| password: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Docker meta | ||
| id: meta | ||
| uses: docker/metadata-action@v5 | ||
| with: | ||
| images: ${{ env.REGISTRY }}/${{ env.REGISTRY_IMAGE }} | ||
| tags: | | ||
| type=schedule | ||
| type=ref,event=branch | ||
| type=ref,event=pr | ||
| type=semver,pattern={{version}} | ||
| type=semver,pattern={{major}}.{{minor}} | ||
| type=semver,pattern={{major}} | ||
| type=sha | ||
| type=raw,value=latest,enable={{is_default_branch}} | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Build and push Docker image for mrefd | ||
| uses: docker/build-push-action@v6 | ||
| with: | ||
| context: . | ||
| file: Containerfile | ||
| platforms: linux/amd64,linux/arm64 | ||
| push: ${{ github.event_name != 'pull_request' }} | ||
| tags: ${{ steps.meta.outputs.tags }} | ||
| labels: ${{ steps.meta.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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| FROM debian:12.11-slim | ||
|
|
||
| # Install dependencies | ||
| RUN apt-get update && \ | ||
| apt-get install -y --no-install-recommends \ | ||
| git build-essential g++ libcurl4-gnutls-dev libopendht-dev \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| # Set the working directory | ||
| WORKDIR /app | ||
| # Copy project to the build context | ||
| COPY . ./ | ||
|
|
||
| # Copy default config files into app dir | ||
| RUN cp config/mrefd.blacklist . \ | ||
| && cp config/mrefd.whitelist . \ | ||
| && cp config/mrefd.interlink . \ | ||
| && cp example.mk mrefd.mk \ | ||
| && cp example.cfg mrefd.cfg | ||
|
|
||
| RUN make \ | ||
| && make install | ||
|
|
||
| EXPOSE 17000/udp 17171/udp | ||
|
|
||
| CMD [ "/usr/local/bin/mrefd", "/app/config/mrefd.cfg" ] |
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
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 @@ | ||
|
|
||
| services: | ||
| mrefd: | ||
| build: | ||
| context: . | ||
| dockerfile: Containerfile | ||
| image: mrefd:latest | ||
| container_name: mrefd | ||
| environment: | ||
| - TZ=${TZ:-America/Chicago} | ||
| volumes: | ||
| - "${CONFIG_PATH:-./mrefd.cfg}:/app/config/mrefd.cfg:ro" | ||
| - "${BLACKLIST_PATH:-./mrefd.blacklist}:/app/config/mrefd.blacklist:ro" | ||
| - "${WHITELIST_PATH:-./mrefd.whitelist}:/app/config/mrefd.whitelist:ro" | ||
| - "${INTERLINK_PATH:-./mrefd.interlink}:/app/config/mrefd.interlink:ro" | ||
| - mrefd_data:/app/data | ||
| # - "${DHT_PATH:-./mrefd.dht.bin}:/app/config/mrefd.dht.bin" # TODO: sort out how to initialize the dht bin as part of env setup before the contrainer loads; empty file results in errors | ||
| ports: | ||
| - ${HOST_M17_PORT:-17000}:${CONTAINER_M17_PORT:-17000}/udp | ||
| - ${HOST_DHT_PORT:-17171}:${CONTAINER_DHT_PORT:-17171}/udp | ||
|
|
||
| restart: unless-stopped | ||
| mrefd_dashboard: | ||
| build: | ||
| context: ./php-dash | ||
| dockerfile: Containerfile | ||
| image: mrefd-dash:latest | ||
| depends_on: | ||
| - mrefd | ||
| container_name: mrefd_dashboard | ||
| environment: | ||
| - TZ=${TZ:-America/Chicago} | ||
| volumes: | ||
| - "${DASH_CONFIG_PATH:-./php-dash/include/config.inc.php}:/var/www/html/php-dash/include/config.inc.php:ro" | ||
| - mrefd_data:/app/data | ||
| ports: | ||
| - ${HOST_DASHBOARD_PORT:-8080}:${CONTAINER_DASHBOARD_PORT:-80} | ||
| restart: unless-stopped | ||
| volumes: | ||
| mrefd_data: | ||
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,3 @@ | ||
| FROM php:8.2-apache | ||
|
|
||
| COPY . /var/www/html |
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
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.