diff --git a/.github/workflows/docker-pr.yml b/.github/workflows/docker-pr.yml index 3ef35dd..7f7e1a7 100644 --- a/.github/workflows/docker-pr.yml +++ b/.github/workflows/docker-pr.yml @@ -39,4 +39,5 @@ jobs: uses: docker/build-push-action@v7 with: context: . + target: full platforms: linux/amd64,linux/arm64 diff --git a/.github/workflows/docker-republish.yml b/.github/workflows/docker-republish.yml index b8916e9..8610be2 100644 --- a/.github/workflows/docker-republish.yml +++ b/.github/workflows/docker-republish.yml @@ -24,7 +24,7 @@ jobs: with: fetch-depth: 0 - - name: 'Get Previous tag' + - name: Get Previous tag id: previoustag uses: "WyriHaximus/github-action-get-previous-tag@v2" @@ -45,11 +45,25 @@ jobs: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - name: Build and Push to Docker Hub + - name: Build and Push slim to Docker Hub uses: docker/build-push-action@v7 with: context: . push: true + target: slim + platforms: linux/amd64,linux/arm64 + tags: | + ghcr.io/qmk/qmk_cli:slim + qmkfm/qmk_cli:slim + ghcr.io/qmk/qmk_cli:${{ steps.previoustag.outputs.tag }}-slim + qmkfm/qmk_cli:${{ steps.previoustag.outputs.tag }}-slim + + - name: Build and Push full to Docker Hub + uses: docker/build-push-action@v7 + with: + context: . + push: true + target: full platforms: linux/amd64,linux/arm64 tags: | ghcr.io/qmk/qmk_cli:latest diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index 31b5cb1..a22dd0d 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -74,11 +74,25 @@ jobs: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - name: Build and Push to Docker Hub + - name: Build and Push slim to Docker Hub uses: docker/build-push-action@v7 with: context: . push: true + target: slim + platforms: linux/amd64,linux/arm64 + tags: | + ghcr.io/qmk/qmk_cli:slim + qmkfm/qmk_cli:slim + ghcr.io/qmk/qmk_cli:${{ env.NEW_CLI_VERSION }}-slim + qmkfm/qmk_cli:${{ env.NEW_CLI_VERSION }}-slim + + - name: Build and Push full to Docker Hub + uses: docker/build-push-action@v7 + with: + context: . + push: true + target: full platforms: linux/amd64,linux/arm64 tags: | ghcr.io/qmk/qmk_cli:latest diff --git a/Dockerfile b/Dockerfile index da990c5..f9763bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/qmk/qmk_base_container:latest as builder +FROM ghcr.io/qmk/qmk_base_container:latest AS builder # Copy package in ADD dist /tmp/dist @@ -21,7 +21,18 @@ RUN python3 -m pip install --upgrade pip setuptools wheel nose2 && \ RUN chmod -R go=u,go-w /opt/uv /opt/qmk # 2nd stage so we don't have /tmp/dist in the final image -FROM ghcr.io/qmk/qmk_base_container:latest +FROM ghcr.io/qmk/qmk_base_container:latest AS slim + +COPY --from=builder /opt/uv /opt/uv + +# Do the equivalent of entering the virtual environment +ENV PATH=/opt/uv/tools/qmk/bin:$PATH \ + VIRTUAL_ENV=/opt/uv/tools/qmk \ + QMK_HOME=/qmk_firmware \ + QMK_USERSPACE=/qmk_userspace + +# 2nd stage so we don't have /tmp/dist in the final image +FROM ghcr.io/qmk/qmk_base_container:latest AS full COPY --from=builder /opt/uv /opt/uv COPY --from=builder /opt/qmk /opt/qmk