From a3a92ce4d3f93b1ca3b54e67b2f407bfdd98a23f Mon Sep 17 00:00:00 2001 From: Kevin Reynolds Date: Sun, 28 Apr 2024 09:09:16 -0400 Subject: [PATCH] more build stuff --- labapp/Dockerfile | 6 ++++- labapp/service_install.sh | 49 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 labapp/service_install.sh diff --git a/labapp/Dockerfile b/labapp/Dockerfile index 21a6d4f..ac1341b 100644 --- a/labapp/Dockerfile +++ b/labapp/Dockerfile @@ -6,4 +6,8 @@ WORKDIR /app COPY app . RUN pip install --no-cache-dir -r requirements.txt -CMD ["python", "./app.py"] \ No newline at end of file +EXPOSE 5000 +ENV FLASK_APP app.py +ENV FLASK_RUN_HOST 0.0.0.0 + +CMD ["flask", "run"] diff --git a/labapp/service_install.sh b/labapp/service_install.sh new file mode 100644 index 0000000..b1d7322 --- /dev/null +++ b/labapp/service_install.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# Update apt +sudo DEBIAN_FRONTEND=noninteractive apt-get update --yes + +# Check if Docker is installed, install it if it's not +if ! command -v docker &> /dev/null +then + echo "Docker could not be found, installing..." + sudo apt-get install -y docker.io +fi + +# Enable and start Docker +sudo systemctl enable docker +sudo systemctl start docker + +# Variable Declarations +IMAGE=ghcr.io/f5devcentral/f5xc-lab-mcn-practical/labapp:latest +SERVICE=mcn-practical-labapp.service +CONTAINER=mcn-practical-labapp + +# Create the systemd service file +sudo bash -c "cat > /etc/systemd/system/$SERVICE <