From e4ff9290b6d875557eafe0b9616760d20d0f9faa Mon Sep 17 00:00:00 2001 From: Sebastien Iooss Date: Fri, 12 Jan 2024 10:18:56 +0100 Subject: [PATCH] fix: fix dockerhub push --- .github/workflows/publish_docker.yml | 8 ++++++-- Readme.md | 20 ++++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish_docker.yml b/.github/workflows/publish_docker.yml index 2f4c90e..2c327fb 100644 --- a/.github/workflows/publish_docker.yml +++ b/.github/workflows/publish_docker.yml @@ -18,17 +18,21 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Setup Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Prepare version variable + run: | + TAG=${{ github.ref_name }} + echo "VERSION=${TAG#v}" >> $GITHUB_ENV - name: Build and push Docker cli image uses: docker/build-push-action@v5 with: context: . file: ./cli.Dockerfile push: true - tags: netmist/give-me-the-odds${{ github.ref_name }} + tags: netmist/give-me-the-odds:${{ env.VERSION }} - name: Build and push Docker server image uses: docker/build-push-action@v5 with: context: . file: ./Dockerfile push: true - tags: netmist/millennium-falcon${{ github.ref_name }} + tags: netmist/millennium-falcon:${{ env.VERSION }} diff --git a/Readme.md b/Readme.md index c26dfaf..3fff6cc 100644 --- a/Readme.md +++ b/Readme.md @@ -4,10 +4,10 @@ - [Tell me the odds](#tell-me-the-odds) - [Architecture](#architecture) - - [Domain model](#domain-model) + - [Domain models](#domain-models) - [Domain services](#domain-services) - [Application services](#application-services) - - [Infrastructure service](#infrastructure-service) + - [Infrastructure services](#infrastructure-services) - [Technology stack](#technology-stack) - [CI](#ci) - [Test](#test) @@ -20,9 +20,15 @@ With a recent version of rust (tested with 1.75.0), you can build the project wi Note that when starting, the webserver will create a folder `logs` containing a file `millennium.log.{date}` with the log of the server. stdio will be pretty silent if everything goes well. The server will be listening on `0.0.0.0:8000`. -It is also possible to start the server with docker by running `docker build -t millennium-falcon .` then `docker run -it --rm -v ./logs:/app/logs -v ./examples:/app/examples -p 0.0.0.0:8000:8000 millennium-falcon examples/millennium-falcon.json` +It is also possible to start the server and the cli with docker. -and the cli by running `docker build -t give-me-the-odds -f cli.Dockerfile .` then `docker run -it --rm -v ./examples:/app/examples give-me-the-odds examples/millennium-falcon.json examples/example1/empire.json` +First + +- Build the docker images locally by running `docker build -t millennium-falcon .` or `docker build -t give-me-the-odds -f cli.Dockerfile .` +- Or pull the images from dockerhub: `docker pull netmist/give-me-the-odds:0.3.0`, `docker pull netmist/millenium-falcon:0.3.0` + +Then run the server with `docker run -it --rm -v ./logs:/app/logs -v ./examples:/app/examples -p 0.0.0.0:8000:8000 millennium-falcon examples/millennium-falcon.json` +and the cli with `docker run -it --rm -v ./examples:/app/examples give-me-the-odds examples/millennium-falcon.json examples/example1/empire.json` ## Architecture @@ -61,17 +67,19 @@ This code was written in Rust 1.75.0. Notables dependencies are : ## CI -2 GitHub workflows are defined. +4 GitHub workflows are defined. - One that performs a security audit every day. More specifically: - Cargo-deny check for security vulnerabilities, license violation, unmaintained projects and several other things. - Cargo-audit for a second security audit. Seems to be more precise than cargo-deny, and also automatically open issue on security vulnerabilities. (see for instance [this issue](https://github.com/Net-Mist/tell-me-the-odds/issues/1)) -- A second that run the classic steps: +- A second that run the classic steps at every push: - format with `cargo-fmt` - lint with `clippy` - build and test in dev mode - build and test again in release mode - compute and publish code coverage +- The third integrate `release-please` to automatically create GitHub releases, version bumps and changelog generation. +- The last one build and publish docker images to dockerhub when a new tag is pushed. ## Test