Skip to content

Commit

Permalink
working on conditional logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Max McKelvey authored and Max McKelvey committed Aug 4, 2023
1 parent f39ed18 commit e28458a
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 77 deletions.
151 changes: 76 additions & 75 deletions .github/workflows/build_docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,50 +37,50 @@ jobs:
uses: docker/build-push-action@v3
with:
tags: docker.io/maxatgroundlight/groundlight-edge-client-frontend:latest
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64,linux/arm/v7
file: ./frontend.Dockerfile
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

build-frontend-armv7:
name: Build Frontend armv7 Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to container registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
registry: docker.io
# build-frontend-armv7:
# name: Build Frontend armv7 Image
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2

# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2

# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2

# - name: Login to container registry
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
# password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
# registry: docker.io

# So now you can use Actions' own caching!
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and Push Image
uses: docker/build-push-action@v3
with:
tags: docker.io/maxatgroundlight/groundlight-edge-client-frontend:latest
platforms: linux/arm/v7
file: ./frontend-armv7.Dockerfile
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
# # So now you can use Actions' own caching!
# - name: Cache Docker layers
# uses: actions/cache@v2
# with:
# path: /tmp/.buildx-cache
# key: ${{ runner.os }}-buildx-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-buildx-

# - name: Build and Push Image
# uses: docker/build-push-action@v3
# with:
# tags: docker.io/maxatgroundlight/groundlight-edge-client-frontend:latest
# platforms: linux/arm/v7
# file: ./frontend-armv7.Dockerfile
# push: true
# cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,dest=/tmp/.buildx-cache

build-backend:
name: Build Backend Image
Expand Down Expand Up @@ -115,48 +115,49 @@ jobs:
uses: docker/build-push-action@v3
with:
tags: docker.io/maxatgroundlight/groundlight-edge-client-backend:latest
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64,linux/arm/v7
file: ./backend.Dockerfile
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
build-backend-armv7:
name: Build Backend armv7 Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to container registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
registry: docker.io
# build-backend-armv7:
# name: Build Backend armv7 Image
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v2

# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2

# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2

# - name: Login to container registry
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
# password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
# registry: docker.io

# So now you can use Actions' own caching!
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and Push Image
uses: docker/build-push-action@v3
with:
tags: docker.io/maxatgroundlight/groundlight-edge-client-backend:latest
platforms: linux/arm/v7
file: ./backend-armv7.Dockerfile
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
# # So now you can use Actions' own caching!
# - name: Cache Docker layers
# uses: actions/cache@v2
# with:
# path: /tmp/.buildx-cache
# key: ${{ runner.os }}-buildx-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-buildx-

# - name: Build and Push Image
# uses: docker/build-push-action@v3
# with:
# tags: docker.io/maxatgroundlight/groundlight-edge-client-backend:latest
# platforms: linux/arm/v7
# file: ./backend-armv7.Dockerfile
# push: true
# cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,dest=/tmp/.buildx-cache
# go here (https://evilmartians.com/chronicles/build-images-on-github-actions-with-docker-layer-caching)
# if cache is overflowing and is breaking
11 changes: 9 additions & 2 deletions backend.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
FROM python:3.9-slim-bookworm
# FROM python:3.9-slim-bookworm
FROM python:3.9-alpine

WORKDIR /app

COPY ./requirements.txt /app/requirements.txt
COPY ./pi_requirements.txt /app/pi_requirements.txt

RUN pip3 install --no-cache-dir --upgrade -r /app/requirements.txt
RUN if [] ; then ; else pip3 install --no-cache-dir --upgrade -r /app/requirements.txt ; fi
RUN pip3 install opencv-python-headless

RUN pip install --index-url=https://www.piwheels.org/simple --no-cache-dir -r /app/requirements.txt
RUN pip install --no-deps groundlight
RUN pip install --no-deps framegrab
RUN pip install pypylon

COPY ./api /app/api

EXPOSE 8000
Expand Down

0 comments on commit e28458a

Please sign in to comment.