-
Notifications
You must be signed in to change notification settings - Fork 125
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: yzamir <kobi.zamir@gmail.com>
- Loading branch information
Showing
10 changed files
with
93 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
# quay.io/rose/rose-common | ||
# Use Red Hat Universal Base Image (UBI) with Python | ||
FROM registry.access.redhat.com/ubi8/python-38 | ||
# with: | ||
# /app/rose/common package | ||
# PYTHONPATH "${PYTHONPATH}:/app" | ||
FROM quay.io/rose/rose-common | ||
|
||
# Set the working directory in the Docker container | ||
WORKDIR /app/rose/client | ||
|
||
# Copy the local package files to the container's workspace | ||
COPY ./__init__.py /app/rose/__init__.py | ||
COPY . /app/rose/client | ||
|
||
# Install the Python dependencies | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
# Add the rose client package to the python path | ||
ENV PYTHONPATH "${PYTHONPATH}:/app" | ||
|
||
# Set the command to run the main.py file when the container launches | ||
ENTRYPOINT ["python", "main.py", "--listen", "0.0.0.0"] | ||
CMD ["--driver", "./mydriver.py", "--port", "8081"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Use Red Hat Universal Base Image (UBI) with Python | ||
FROM registry.access.redhat.com/ubi8/python-38 | ||
|
||
# Set the working directory in the Docker container | ||
WORKDIR /app/rose/common | ||
|
||
# Make app.rose a python package | ||
COPY __init__.py /app/rose/ | ||
|
||
# Copy the local package files to rose.common | ||
COPY __init__.py /app/rose/common/ | ||
COPY actions.py /app/rose/common/ | ||
COPY obstacles.py /app/rose/common/ | ||
|
||
# Add the rose client package to the python path | ||
ENV PYTHONPATH "${PYTHONPATH}:/app" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
.PHONY: lint lint-fix build-image | ||
|
||
IMAGE_NAME ?= quay.io/rose/rose-common | ||
|
||
# By default, run both linting and tests | ||
all: lint | ||
|
||
lint: | ||
@echo "Running flake8 linting..." | ||
flake8 --show-source --statistics . | ||
black --check --diff . | ||
|
||
lint-fix: | ||
@echo "Running lint fixing..." | ||
@black --verbose --color . | ||
|
||
build-image: | ||
@echo "Building container image ..." | ||
podman build -t $(IMAGE_NAME) . |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
""" Driving actions """ | ||
|
||
NONE = "none" # NOQA | ||
RIGHT = "right" # NOQA | ||
LEFT = "left" # NOQA | ||
PICKUP = "pickup" # NOQA | ||
JUMP = "jump" # NOQA | ||
BRAKE = "brake" # NOQA | ||
|
||
ALL = (NONE, RIGHT, LEFT, PICKUP, JUMP, BRAKE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" Game obstacles """ | ||
|
||
import random | ||
|
||
NONE = "" # NOQA | ||
CRACK = "crack" # NOQA | ||
TRASH = "trash" # NOQA | ||
PENGUIN = "penguin" # NOQA | ||
BIKE = "bike" # NOQA | ||
WATER = "water" # NOQA | ||
BARRIER = "barrier" # NOQA | ||
|
||
ALL = (NONE, CRACK, TRASH, PENGUIN, BIKE, WATER, BARRIER) | ||
|
||
|
||
def get_random_obstacle(): | ||
return random.choice(ALL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters