mirror of
https://github.com/tmdinosaurcenter/kiosk-guestbook.git
synced 2025-04-08 13:11:28 -06:00
Making the header/title are a variable
Refactor Dockerfile and entrypoint script; add index.html.template and update example.env
This commit is contained in:
parent
9f462c4c0a
commit
e25cdca466
15
Dockerfile
15
Dockerfile
@ -4,18 +4,25 @@ FROM python:3.9-slim
|
||||
# Set the working directory
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies
|
||||
# Install system dependencies (including gettext for envsubst)
|
||||
RUN apt-get update && apt-get install -y gettext && rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy the application code
|
||||
# Copy the application code and template files
|
||||
COPY . .
|
||||
|
||||
# Copy the entrypoint script into the container and make it executable
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
# Set environment variables (can be overridden by .env)
|
||||
ENV FLASK_ENV=production
|
||||
|
||||
# Expose the port (Gunicorn will run on 8000)
|
||||
EXPOSE 8000
|
||||
|
||||
# Run the app with Gunicorn; use 3 workers (can be tuned via .env)
|
||||
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "app:app", "--workers", "3"]
|
||||
# Use the entrypoint script as the container's command
|
||||
CMD ["/entrypoint.sh"]
|
||||
|
@ -8,3 +8,4 @@ DATABASE_PATH=/data/scripts/guestbook.db
|
||||
GUNICORN_WORKERS=3
|
||||
PID=1000
|
||||
GID=1000
|
||||
SITE_TITLE="The Montana Dinosaur Center Visitor Log"
|
||||
|
7
scripts/entrypoint.sh
Normal file
7
scripts/entrypoint.sh
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
# Process index.html.template to create index.html
|
||||
# Adjust the path if your template is located somewhere else
|
||||
envsubst < /templates/index.html.template > /templates/index.html
|
||||
|
||||
# Start Gunicorn; using an environment variable for workers (default is 3)
|
||||
exec gunicorn --bind 0.0.0.0:8000 app:app --workers ${WORKERS:-3}
|
@ -4,7 +4,8 @@
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>The Montana Dinosaur Center Visitor Log</title>
|
||||
<title>${SITE_TITLE}</title>
|
||||
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<style>
|
||||
@ -40,8 +41,8 @@
|
||||
<body>
|
||||
<div class="container mt-5 mb-5">
|
||||
<header class="d-flex align-items-center mb-4">
|
||||
<img src="static/images/logo.png" alt="Museum Logo" class="me-3" style="height: 50px;" />
|
||||
<h1 class="h3 mb-0">The Montana Dinosaur Center Visitor Log</h1>
|
||||
<img src="static/images/logo.png" alt="Logo" class="me-3" style="height: 50px;" />
|
||||
<h1 class="h3 mb-0">${SITE_TITLE}</h1>
|
||||
</header>
|
||||
|
||||
<!-- Brief instructions for the form -->
|
Loading…
x
Reference in New Issue
Block a user