From 486ed4c958959cf9aa2ad232e72700092696315c Mon Sep 17 00:00:00 2001 From: NexVeridian Date: Fri, 14 Jun 2024 15:10:05 -0700 Subject: [PATCH] fix: docker push --- .devcontainer/devcontainer.json | 8 +++++++- .github/workflows/docker.yml | 27 +++++++++++++-------------- Cargo.lock | 4 ++-- flake.nix | 3 ++- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 88d180c..82b13bd 100755 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -27,6 +27,11 @@ "source": "${localWorkspaceFolderBasename}-target", "target": "${containerWorkspaceFolder}/target", "type": "volume" + }, + { + "source": "nix-store", + "target": "/nix/store", + "type": "volume" } ], // Features to add to the dev container. More info: https://containers.dev/features. @@ -51,7 +56,8 @@ "postAttachCommand": { "AddGitSafeDir": "git config --global --add safe.directory /workspaces/${containerWorkspaceFolderBasename}", "update": "rustup target add x86_64-unknown-linux-musl && rustup update && cargo update", - "clippy": "cargo clippy --fix --allow-dirty" + "clippy": "cargo clippy --fix --allow-dirty", + "nix flake update": "nix flake update" }, // Configure tool-specific properties. // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a865bbf..21e1cb6 100755 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -1,4 +1,4 @@ -name: Docker +name: docker on: workflow_run: @@ -73,17 +73,16 @@ jobs: # https://github.com/orgs/community/discussions/25768#discussioncomment-3249183 - name: Downcase REPO run: | - echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV} + echo "REPO=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} - # Build and push Docker image with Buildx (don't push on PR) - # https://github.com/docker/build-push-action - - name: Build and push Docker image - id: build-and-push - uses: docker/build-push-action@v5 - with: - context: ./result - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ env.REGISTRY }}/${{ env.REPO }}:latest - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max + - name: Strip REPO Username + run: | + STRIP_REPO_USERNAME=$(echo "${{ env.REPO }}" | sed 's/nexveridian\///') + echo "STRIP_REPO_USERNAME=${STRIP_REPO_USERNAME}" >> ${GITHUB_ENV} + + # https://github.com/docker/build-push-action/issues/538 + - name: Push and tag Docker image + run: | + docker load < result + docker tag ${{ env.STRIP_REPO_USERNAME }}:latest ${{ env.REGISTRY }}/${{ env.REPO }}:latest + docker push ${{ env.REGISTRY }}/${{ env.REPO }}:latest diff --git a/Cargo.lock b/Cargo.lock index 14cad21..f0d7cd1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1725,9 +1725,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" dependencies = [ "bitflags 2.5.0", ] diff --git a/flake.nix b/flake.nix index 3761e8a..b92b42e 100644 --- a/flake.nix +++ b/flake.nix @@ -73,7 +73,8 @@ tag = "latest"; copyToRoot = [ my-crate ]; config = { - Cmd = [ "${my-crate}/bin/ark-invest-api-rust" ]; + Cmd = [ "./ark-invest-api-rust" ]; + WorkingDir = "${my-crate}/ark-invest-api-rust"; Env = [ "PORT=3000" ]; Expose = [ 3000 ]; };