Skip to content
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

fix: ensure stable and latest releases are properly built #131

Merged
merged 11 commits into from
Oct 10, 2024
15 changes: 14 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
- name: Build and push latest
if: contains(steps.meta.outputs.tag, 'latest')
uses: docker/build-push-action@v4
with:
context: .
Expand All @@ -68,6 +69,18 @@ jobs:
build-args: |
BASE_APE_IMAGE_TAG=stable

- name: Build and push stable
if: contains(steps.meta.outputs.tag, 'stable')
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile.stable
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BASE_APE_IMAGE_TAG=stable

- name: Fetch all tags and store them
run: |
# List all tags
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ COPY . .
# upgrade pip and install wheel
RUN pip install --upgrade pip && pip install wheel
# install silverback
RUN pip wheel . --wheel-dir=/wheels
RUN pip wheel . --wheel-dir=/wheels --no-deps

# Install from wheels
FROM ghcr.io/apeworx/ape:${BASE_APE_IMAGE_TAG:-latest}
Expand All @@ -22,7 +22,7 @@ RUN pip install --upgrade pip \
--no-cache-dir --find-links=/wheels \
'taskiq-sqs>=0.0.11' \
'taskiq-redis>=1.0.2,<2' \
silverback
/wheels/silverback-*.whl

USER harambe

Expand Down
29 changes: 29 additions & 0 deletions Dockerfile.stable
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#---------------------------------------------------------------------------------------------
# See LICENSE in the project root for license information.
#---------------------------------------------------------------------------------------------

# Build with builder image to reduce image size
ARG BASE_APE_IMAGE_TAG
FROM python:3.11 as builder
USER root
WORKDIR /wheels
COPY . .
# upgrade pip and install wheel
RUN pip install --upgrade pip && pip install wheel
# install silverback
RUN pip wheel . --wheel-dir=/wheels

# Install from wheels
FROM ghcr.io/apeworx/ape:${BASE_APE_IMAGE_TAG:-latest}
USER root
COPY --from=builder /wheels/*.whl /wheels
RUN pip install --upgrade pip \
&& pip install \
--no-cache-dir --find-links=/wheels \
'taskiq-sqs>=0.0.11' \
'taskiq-redis>=1.0.2,<2' \
silverback

USER harambe

ENTRYPOINT ["silverback"]
Loading