Skip to content

Commit

Permalink
add docker conf
Browse files Browse the repository at this point in the history
  • Loading branch information
appad committed May 8, 2024
1 parent 001aa45 commit f46a177
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 9 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/docker-build-scheduler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: ci

on:
push:
branches:
- 'master'
workflow_dispatch:


jobs:
docker:
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: downcase REPO name as output
id: downcase
run: |
echo "::set-output name=downcase::$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')"
- name: Build and push
uses: docker/build-push-action@v5
with:
context: ./gui/scheduler
platforms: linux/amd64,linux/arm64
file: ./api/Dockerfile
push: true
tags: ghcr.io/${{ steps.downcase.outputs.downcase }}/scheduler:latest,ghcr.io/${{ steps.downcase.outputs.downcase }}/scheduler:${{ github.sha }}
11 changes: 11 additions & 0 deletions gui/scheduler/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.10-alpine

COPY requirements.txt /app/requirements.txt

RUN pip install -r /app/requirements.txt

COPY . /app

WORKDIR /app

CMD ["python", "solve_eternity.py"]
8 changes: 8 additions & 0 deletions gui/scheduler/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
numpy
colour
Pillow
gradio
plotly
kaleido
lxml
grpcio-tools
17 changes: 8 additions & 9 deletions gui/scheduler/solve_eternity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,25 @@

from scheduler.solve import solve, response_to_dict
from scheduler.solver.v1 import solver_pb2
import os

curr_dir = Path(__file__).parent
output_dir = curr_dir / 'output'
servers = [
# 'localhost:50051',
# 'node-apoorva2.k3s.hs.ozeliurs.com:50051',
# 'node-apoorva3-abklev50.k3s.hs.ozeliurs.com:50051',
'vmpx15.polytech.hs.ozeliurs.com:50051',
# "vmpx15.polytech.hs.ozeliurs.com:50059"
'localhost:50051',
]

req = json.load(open(curr_dir / 'eternity2.json'))
if os.environ.get('ETERNITY2_SERVERS'):
servers = [server.strip() for server in os.environ.get('ETERNITY2_SERVERS').split(',')]

print(req)
req = json.load(open(curr_dir / 'eternity2.json'))

request = solver_pb2.SolverSolveRequest(**req)

# Call the server
response = solve(servers, request, store_responses='responses.json', sleep_time=req['wait_time'] / 1000 + 1)
response = solve(servers, request, store_responses='output/responses.json', sleep_time=req['wait_time'] / 1000 + 1)

# save the response
with open('found.json', 'w') as f:
with open('output/found.json', 'w') as f:
f.write(json.dumps(response_to_dict([response])))
f.write('\n')

0 comments on commit f46a177

Please sign in to comment.