Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
**/*.ipynb
**/*.ipynb
**/*.pyi
**/__pycache__/
**/*.proto
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,23 @@ Once the app is running, you can access it by navigating to:
You can pull the application image directly from Docker Hub if you prefer not to build locally:

- [Docker Hub - ML Telemetry](https://hub.docker.com/r/nightofthelivingcarrots512/solarcar-ml)

## Generate Python Code from Protobuf

Install the protobuf compiler:

- [Protobuf Installation](https://github.com/protocolbuffers/protobuf)

Generate Python code from the protobuf file:

```bash
cd ./protobufServer/app
protoc --python_out=. --pyi_out=. HeliosPacket.proto
```

Navigate back to the root directory and run the following command to start the server:

```bash
cd ./protobufServer
docker-compose up --build
```
4 changes: 4 additions & 0 deletions protobufServer/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/*.ipynb
**/*.pyi
**/__pycache__/
**/*.proto
22 changes: 22 additions & 0 deletions protobufServer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM python:3.9-slim

# Set environment variables to optimize Python
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1

# Set working directory
WORKDIR /app

# Install apt packages and clean up
RUN apt-get update && apt-get install -y --no-install-recommends \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Copy requirements and install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code
COPY ./app .

# Final CMD (make sure this is the right one)
CMD [ "uvicorn", "app:app", "--host", "0.0.0.0"]
Loading