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
27 changes: 4 additions & 23 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,19 @@
# Image for a Python 3 development environment
##################################################
# cSpell: disable
FROM quay.io/rofrano/python:3.12-slim
FROM quay.io/rofrano/nyu-devops-base:sp26

# Add any tools that are needed beyond Python 3.11
RUN apt-get update && \
apt-get install -y sudo vim make git zip tree curl wget jq procps net-tools iputils-ping && \
apt-get autoremove -y && \
apt-get clean -y

# Create a user for development
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID

# 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 \
&& echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \
&& chmod 0440 /etc/sudoers.d/$USERNAME \
&& chown -R $USERNAME:$USERNAME /home/$USERNAME
USER root

# Set up the Python development environment
WORKDIR /app
COPY Pipfile Pipfile.lock ./
RUN python -m pip install --upgrade pip pipenv && \
pipenv install --system --dev

ENV PORT=8080
EXPOSE $PORT

# Enable color terminal for docker exec bash
ENV TERM=xterm-256color
# Configuring insecure Docker registry
COPY config/insecure-registry.json /etc/docker/daemon.json

# Become a regular user for development
USER $USERNAME
Expand Down
5 changes: 3 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@
"forwardPorts": [8080],
"postCreateCommand": "bash /app/.devcontainer/scripts/setup-lab.sh",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/kubectl-helm-minikube:1": {}
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"moby": false
}
}
}
2 changes: 0 additions & 2 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
# Python 3 with PostgreSQL
version: "3"

services:
app:
build:
Expand Down
31 changes: 25 additions & 6 deletions .devcontainer/scripts/install-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
######################################################################
# These scripts are meant to be run in user mode as they modify
# usr settings line .bashrc and .bash_aliases
# Copyright 2022, 2024 John J. Rofrano All Rights Reserved.
# Copyright 2022, 2026 John J. Rofrano All Rights Reserved.
######################################################################

echo "**********************************************************************"
Expand All @@ -12,6 +12,18 @@ echo "**********************************************************************"
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')"
echo "Architecture is:" $ARCH

echo "**********************************************************************"
echo "Installing Kubernetes Command Line Interface (kubectl)..."
echo "**********************************************************************"
release=$(curl -s https://dl.k8s.io/release/stable.txt)
curl -LO "https://dl.k8s.io/release/${release}/bin/linux/${ARCH}/kubectl"
chmod +x ./kubectl
sudo install -c -m 0755 kubectl /usr/local/bin
rm ./kubectl
echo "Creating kc and kns alias for kubectl..."
echo "alias kc='/usr/local/bin/kubectl'" >> $HOME/.bash_aliases
echo "alias kns='kubectl config set-context --current --namespace'" >> $HOME/.bash_aliases

echo "**********************************************************************"
echo "Installing K3D Kubernetes..."
echo "**********************************************************************"
Expand All @@ -21,10 +33,17 @@ echo "alias kc='/usr/local/bin/kubectl'" >> $HOME/.bash_aliases
echo "alias kns='kubectl config set-context --current --namespace'" >> $HOME/.bash_aliases
sudo sh -c 'echo "127.0.0.1 cluster-registry" >> /etc/hosts'

echo "**********************************************************************"
echo "Installing Helm..."
echo "**********************************************************************"
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-4
chmod 700 get_helm.sh
./get_helm.sh

echo "**********************************************************************"
echo "Installing K9s..."
echo "**********************************************************************"
curl -L -o k9s.tar.gz "https://github.com/derailed/k9s/releases/download/v0.50.16/k9s_Linux_$ARCH.tar.gz"
curl -L -o k9s.tar.gz "https://github.com/derailed/k9s/releases/download/v0.50.18/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 +63,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.33.0/stern_1.32.0_linux_$ARCH.tar.gz"
curl -L -o stern.tar.gz "https://github.com/stern/stern/releases/download/v1.33.1/stern_1.33.1_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.20.0/kn-linux-$ARCH"
curl -L -o kn "https://github.com/knative/client/releases/download/knative-v1.21.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.42.0/tkn_0.42.0_Linux_x86_64.tar.gz --output tekton.tar.gz
curl -L https://github.com/tektoncd/cli/releases/download/v0.43.1/tkn_0.43.1_Linux_x86_64.tar.gz --output tekton.tar.gz
else
curl -L https://github.com/tektoncd/cli/releases/download/v0.42.0/tkn_0.42.0_Linux_aarch64.tar.gz --output tekton.tar.gz
curl -L https://github.com/tektoncd/cli/releases/download/v0.43.1/tkn_0.43.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
31 changes: 18 additions & 13 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,29 @@ verify_ssl = true
name = "pypi"

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

[dev-packages]
honcho = "~=2.0.0"
pylint = "~=3.3.4"
flake8 = "~=7.1.1"
black = "~=25.1.0"
pytest = "~=8.3.4"
# Code Quality
pylint = "~=4.0.4"
flake8 = "~=7.3.0"
black = "~=26.3.1"

# Test-Driven Development
pytest = "~=9.0.2"
pytest-pspec = "~=0.0.4"
pytest-cov = "~=6.0.0"
pytest-cov = "~=7.0.0"
factory-boy = "~=3.3.3"
coverage = "~=7.6.12"
coverage = "~=7.13.2"

# Utility
honcho = "~=2.0.0"
httpie = "~=3.2.4"

[requires]
python_version = "3.11"
python_version = "3.12"
Loading
Loading