Skip to content
Merged
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
11 changes: 5 additions & 6 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Image for a Python 3 development environment
FROM python:3.11-slim
FROM quay.io/rofrano/python:3.11-slim

# Add any tools that are needed beyond Python 3.11
RUN apt-get update && \
Expand All @@ -12,7 +12,7 @@ ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# Create the user with passwordless sudo privileges
# Create the user with password-less sudo privileges
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME -s /bin/bash \
&& usermod -aG sudo $USERNAME \
Expand All @@ -22,10 +22,9 @@ RUN groupadd --gid $USER_GID $USERNAME \

# Set up the Python development environment
WORKDIR /app
COPY pyproject.toml poetry.lock ./
RUN sudo python -m pip install --upgrade pip poetry && \
sudo poetry config virtualenvs.create false && \
sudo poetry install
COPY Pipfile Pipfile.lock ./
RUN python -m pip install --upgrade pip pipenv && \
pipenv install --system --dev

ENV PORT=8080
EXPOSE $PORT
Expand Down
3 changes: 1 addition & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"sqlalchemy",
"psycopg",
"pytest",
"pipenv",
"tekton",
"creds",
"virtualenvs"
Expand Down Expand Up @@ -57,9 +58,7 @@
"hbenl.vscode-test-explorer",
"LittleFoxTeam.vscode-python-test-adapter",
"redhat.vscode-yaml",
"rangav.vscode-thunder-client",
"ms-azuretools.vscode-docker",
"redhat.fabric8-analytics",
"inercia.vscode-k3d",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"redhat.vscode-openshift-connector",
Expand Down
10 changes: 5 additions & 5 deletions .devcontainer/scripts/install-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ sudo sh -c 'echo "127.0.0.1 cluster-registry" >> /etc/hosts'
echo "**********************************************************************"
echo "Installing K9s..."
echo "**********************************************************************"
curl -L -o k9s.tar.gz "https://github.com/derailed/k9s/releases/download/v0.32.6/k9s_Linux_$ARCH.tar.gz"
curl -L -o k9s.tar.gz "https://github.com/derailed/k9s/releases/download/v0.32.7/k9s_Linux_$ARCH.tar.gz"
tar xvzf k9s.tar.gz
sudo install -c -m 0755 k9s /usr/local/bin
rm k9s.tar.gz
Expand All @@ -44,25 +44,25 @@ sudo install -c -m 0755 devspace /usr/local/bin
echo "**********************************************************************"
echo "Installing Stern..."
echo "**********************************************************************"
curl -L -o stern.tar.gz "https://github.com/stern/stern/releases/download/v1.31.0/stern_1.31.0_linux_$ARCH.tar.gz"
curl -L -o stern.tar.gz "https://github.com/stern/stern/releases/download/v1.32.0/stern_1.32.0_linux_$ARCH.tar.gz"
tar xvzf stern.tar.gz
sudo install -c -m 0755 stern /usr/local/bin
rm stern.tar.gz LICENSE

echo "**********************************************************************"
echo "Installing Knative CLI..."
echo "**********************************************************************"
curl -L -o kn "https://github.com/knative/client/releases/download/knative-v1.16.0/kn-linux-$ARCH"
curl -L -o kn "https://github.com/knative/client/releases/download/knative-v1.17.0/kn-linux-$ARCH"
sudo install -c -m 0755 kn /usr/local/bin
rm kn

echo "**********************************************************************"
echo "Installing Tekton CLI..."
echo "**********************************************************************"
if [ $ARCH == amd64 ]; then
curl -L https://github.com/tektoncd/cli/releases/download/v0.38.1/tkn_0.38.1_Linux_x86_64.tar.gz --output tekton.tar.gz
curl -L https://github.com/tektoncd/cli/releases/download/v0.39.1/tkn_0.39.1_Linux_x86_64.tar.gz --output tekton.tar.gz
else
curl -L https://github.com/tektoncd/cli/releases/download/v0.38.1/tkn_0.38.1_Linux_aarch64.tar.gz --output tekton.tar.gz
curl -L https://github.com/tektoncd/cli/releases/download/v0.39.1/tkn_0.39.1_Linux_aarch64.tar.gz --output tekton.tar.gz
fi;
tar xvzf tekton.tar.gz tkn
sudo install -c -m 0755 tkn /usr/local/bin
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ jobs:

- name: Install dependencies
run: |
python -m pip install -U pip poetry
poetry config virtualenvs.create false
poetry install
python -m pip install -U pip pipenv
pipenv install --system --dev

- name: Linting
run: |
Expand Down
13 changes: 6 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
##################################################
FROM quay.io/rofrano/python:3.11-slim

# Create working folder and install dependencies without dev
# Set up the Python production environment
WORKDIR /app
COPY pyproject.toml poetry.lock ./
RUN python -m pip install --upgrade pip poetry && \
poetry config virtualenvs.create false && \
poetry install --no-root --without dev
COPY Pipfile Pipfile.lock ./
RUN python -m pip install --upgrade pip pipenv && \
pipenv install --system --deploy

# Copy the application contents
COPY wsgi.py .
Expand All @@ -20,10 +19,10 @@ RUN useradd --uid 1001 flask && \
USER flask

# Expose any ports the app is expecting in the environment
ENV FLASK_APP=wsgi:app
ENV FLASK_APP="wsgi:app"
ENV PORT=8080
EXPOSE $PORT

ENV GUNICORN_BIND 0.0.0.0:$PORT
ENV GUNICORN_BIND=0.0.0.0:$PORT
ENTRYPOINT ["gunicorn"]
CMD ["--log-level=info", "wsgi:app"]
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ knative: ## Install Knative
# kubectl apply -f https://github.com/knative/eventing/releases/download/knative-v1.12.0/eventing-core.yaml

.PHONY: deploy
depoy: ## Deploy the service on local Kubernetes
deploy: ## Deploy the service on local Kubernetes
$(info Deploying service locally...)
kubectl apply -f k8s/

Expand All @@ -119,12 +119,12 @@ init: ## Creates the buildx instance

.PHONY: build
build: ## Build the project container image for local platform
$(info Building $(IMAGE) for $(PLATFORM)...)
$(info Building $(IMAGE)...)
docker build --rm --pull --tag $(IMAGE) .

.PHONY: push
push: ## Push the image to the container registry
$(info Pusing $(IMAGE) for $(PLATFORM)...)
$(info Pushing $(IMAGE)...)
docker push $(IMAGE)

.PHONY: buildx
Expand Down
27 changes: 27 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
flask = "~=3.1.0"
flask-sqlalchemy = "~=3.1.1"
psycopg = {extras = ["binary"], version = "~=3.2.4"}
retry2 = "~=0.9.5"
python-dotenv = "~=1.0.1"
gunicorn = "~=23.0.0"

[dev-packages]
black = "~=25.1.0"
coverage = "~=7.6.10"
flake8 = "~=7.1.1"
pylint = "~=3.3.4"
pytest = "~=8.3.4"
pytest-pspec = "~=0.0.4"
pytest-cov = "~=6.0.0"
factory-boy = "~=3.3.1"
honcho = "~=2.0.0"
httpie = "~=3.2.4"

[requires]
python_version = "3.11"
Loading