-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
5da5a25 dev: container overhaul (Cameron Garnham) Pull request description: Depends on #391 Ready for Review. :) Big Update for Containers. - [x] Rework Dockerfile - [x] Rework Container Workflow - [x] Rework Docker Compose File - [x] Rework Environmental Variables Todo: - [x] Review Documentation. - [x] Rebase and Make Good Commit History Moved to a new issue: - [x] Review Docker Publishing Workflows. closes #389 ACKs for top commit: da2ce7: ACK 5da5a25 Tree-SHA512: b010cae18b3934f35fa52e6d121db1631d5cae2ba48a9a4ec5c4c9f7d6b18870a6d43f3bdb6c9e412ad4f9f0a9b5625fa7e6665c75b9329ca024e4d545501552
- Loading branch information
Showing
48 changed files
with
1,479 additions
and
756 deletions.
There are no files selected for viewing
This file contains 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,16 +1,16 @@ | ||
.git | ||
.git-blame-ignore | ||
.github | ||
.gitignore | ||
.vscode | ||
bin/ | ||
config.toml | ||
config.toml.local | ||
cSpell.json | ||
data.db | ||
docker/ | ||
NOTICE | ||
README.md | ||
rustfmt.toml | ||
storage/ | ||
target/ | ||
/.git | ||
/.git-blame-ignore | ||
/.github | ||
/.gitignore | ||
/.vscode | ||
/bin/ | ||
/tracker.* | ||
/cSpell.json | ||
/data.db | ||
/docker/bin/ | ||
/NOTICE | ||
/README.md | ||
/rustfmt.toml | ||
/storage/ | ||
/target/ | ||
/etc/ |
This file was deleted.
Oops, something went wrong.
This file contains 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,125 @@ | ||
name: Container | ||
|
||
on: | ||
push: | ||
tags-ignore: | ||
- "!v*" | ||
pull_request: | ||
branches: | ||
- "develop" | ||
- "main" | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
test: | ||
name: Test (Docker) | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- id: setup | ||
name: Setup Toolchain | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- id: build | ||
name: Build | ||
uses: docker/build-push-action@v4 | ||
with: | ||
file: ./Containerfile | ||
push: false | ||
load: true | ||
tags: torrust-tracker:local | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- id: inspect | ||
name: Inspect | ||
run: docker image inspect torrust-tracker:local | ||
|
||
- id: checkout | ||
name: Checkout Repository | ||
uses: actions/checkout@v3 | ||
|
||
- id: compose | ||
name: Compose | ||
run: docker compose build | ||
|
||
context: | ||
name: Context | ||
needs: test | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
continue: ${{ steps.check.outputs.continue }} | ||
|
||
steps: | ||
- id: check | ||
name: Check Context | ||
run: | | ||
if [[ "${{ github.event_name }}" == "push" && ( "${{ github.ref }}" == "refs/heads/main" || "${{ github.ref }}" == "refs/heads/develop" || "${{ github.ref }}" == "refs/heads/docker" ) ]] || | ||
[[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
if [[ "${{ github.repository }}" == "torrust/torrust-tracker" ]]; then | ||
echo "Context is torrust/torrust-tracker, and push is: main, develop, docker, or a tag of v*.*.*" | ||
echo "continue=true" >> $GITHUB_OUTPUT | ||
fi | ||
fi | ||
secrets: | ||
name: Secrets | ||
needs: context | ||
environment: dockerhub-torrust | ||
if: needs.context.outputs.continue == 'true' | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
continue: ${{ steps.check.outputs.continue }} | ||
|
||
steps: | ||
- id: check | ||
name: Check | ||
env: | ||
DOCKER_HUB_ACCESS_TOKEN: "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | ||
if: "${{ env.DOCKER_HUB_ACCESS_TOKEN != '' }}" | ||
run: echo "continue=true" >> $GITHUB_OUTPUT | ||
|
||
publish: | ||
name: Publish | ||
environment: dockerhub-torrust | ||
needs: secrets | ||
if: needs.secrets.outputs.continue == 'true' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- id: meta | ||
name: Docker meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
"${{ secrets.DOCKER_HUB_USERNAME }}/${{secrets.DOCKER_HUB_REPOSITORY_NAME }}" | ||
tags: | | ||
type=ref,event=branch | ||
type=ref,event=pr | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
- id: login | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | ||
|
||
- id: setup | ||
name: Setup Toolchain | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
file: ./Containerfile | ||
push: ${{ github.event_name != 'pull_request' }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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 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,23 +1,23 @@ | ||
{ | ||
"[rust]": { | ||
"editor.formatOnSave": true | ||
}, | ||
"rust-analyzer.checkOnSave": true, | ||
"rust-analyzer.check.command": "clippy", | ||
"rust-analyzer.check.allTargets": true, | ||
"rust-analyzer.check.extraArgs": [ | ||
"--", | ||
"-D", | ||
"clippy::correctness", | ||
"-D", | ||
"clippy::suspicious", | ||
"-W", | ||
"clippy::complexity", | ||
"-W", | ||
"clippy::perf", | ||
"-W", | ||
"clippy::style", | ||
"-W", | ||
"clippy::pedantic", | ||
], | ||
"[rust]": { | ||
"editor.formatOnSave": true | ||
}, | ||
"rust-analyzer.checkOnSave": true, | ||
"rust-analyzer.check.command": "clippy", | ||
"rust-analyzer.check.allTargets": true, | ||
"rust-analyzer.check.extraArgs": [ | ||
"--", | ||
"-D", | ||
"clippy::correctness", | ||
"-D", | ||
"clippy::suspicious", | ||
"-W", | ||
"clippy::complexity", | ||
"-W", | ||
"clippy::perf", | ||
"-W", | ||
"clippy::style", | ||
"-W", | ||
"clippy::pedantic", | ||
], | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.