Skip to content

Commit

Permalink
Seperate arm/v7 Dockerfile to build beancount from source
Browse files Browse the repository at this point in the history
  • Loading branch information
StdioA committed Aug 22, 2024
1 parent aafc967 commit 8edfb74
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 2 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/build_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,27 @@ jobs:
password: ${{ secrets.GHCR_PAT }}

- name: Build and push to GHCR
uses: docker/build-push-action@v2
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
platforms: linux/amd64,linux/arm64
file: Dockerfile
push: true
tags: |
${{ env.GHCR_REPO }}:latest
${{ env.GHCR_REPO }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Build for arm/v7 and push to GHCR
uses: docker/build-push-action@v6
with:
context: .
platforms: linux/arm/v7
file: Dockerfile-armv7
push: true
tags: |
${{ env.GHCR_REPO }}:latest
${{ env.GHCR_REPO }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
28 changes: 28 additions & 0 deletions Dockerfile-armv7
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Build beancount from source due to wheel for arm/v7 is not provided
FROM python:3.11 AS builder

RUN pip install --upgrade uv && mkdir -p /app
WORKDIR /app
ENV VIRTUAL_ENV=/packages/.venv
COPY requirements-full.txt requirements-optional.txt /app/
RUN mkdir -p $VIRTUAL_ENV && uv venv $VIRTUAL_ENV
RUN uv pip install --no-cache-dir -r requirements-full.txt && \
(uv pip install --no-cache-dir -r requirements-optional.txt || true)


FROM python:3.11-slim

RUN pip install --upgrade uv && mkdir -p /app
WORKDIR /app
COPY requirements-full.txt requirements-optional.txt /app/
ENV VIRTUAL_ENV=/packages/.venv
RUN mkdir -p $VIRTUAL_ENV && uv venv $VIRTUAL_ENV
COPY --from=builder /packages/.venv/lib/ $VIRTUAL_ENV/lib/
RUN uv pip install --no-cache-dir -r requirements-full.txt && \
(uv pip install --no-cache-dir -r requirements-optional.txt || true)
COPY . /app

VOLUME /data/ledger
WORKDIR /data/ledger
ENTRYPOINT ["/app/entrypoint.sh", "python", "/app/main.py"]
CMD ["telegram"]

0 comments on commit 8edfb74

Please sign in to comment.