mirror of
https://github.com/Sudo-JHare/FHIRFLARE-IG-Toolkit.git
synced 2025-11-05 13:35:15 +00:00
feat: reduce and optimize for python
This commit is contained in:
parent
75639c176c
commit
8d078e672b
69
Dockerfile
69
Dockerfile
@ -1,31 +1,52 @@
|
|||||||
# Base image with Python and Java
|
# ------------------------------------------------------------------------------
|
||||||
FROM tomcat:10.1-jdk17
|
# Dockerfile for FHIRFLARE-IG-Toolkit (Optimized for Python/Flask)
|
||||||
|
#
|
||||||
|
# This Dockerfile builds a container for the FHIRFLARE-IG-Toolkit application.
|
||||||
|
#
|
||||||
|
# Key Features:
|
||||||
|
# - Uses python:3.11-slim as the base image for a minimal, secure Python runtime.
|
||||||
|
# - Installs Node.js and global NPM packages (gofsh, fsh-sushi) for FHIR IG tooling.
|
||||||
|
# - Sets up a Python virtual environment and installs all Python dependencies.
|
||||||
|
# - Installs and configures Supervisor to manage the Flask app and related processes.
|
||||||
|
# - Copies all necessary application code, templates, static files, and configuration.
|
||||||
|
# - Exposes ports 5000 (Flask) and 8080 (optional, for compatibility).
|
||||||
|
# - Entrypoint runs Supervisor for process management.
|
||||||
|
#
|
||||||
|
# Notes:
|
||||||
|
# - The Dockerfile is optimized for Python. Tomcat/Java is not included.
|
||||||
|
# - Node.js is only installed if needed for FHIR IG tooling.
|
||||||
|
# - The image is suitable for development and production with minimal changes.
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Install build dependencies, Node.js 18, and coreutils (for stdbuf)
|
# Optimized Dockerfile for Python (Flask)
|
||||||
|
FROM python:3.11-slim AS base
|
||||||
|
|
||||||
|
# Install system dependencies
|
||||||
RUN apt-get update && apt-get install -y --no-install-recommends \
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
python3 python3-pip python3-venv curl coreutils \
|
curl \
|
||||||
&& curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
|
coreutils \
|
||||||
&& apt-get install -y --no-install-recommends nodejs \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Install specific versions of GoFSH and SUSHI
|
# Optional: Install Node.js if needed for GoFSH/SUSHI
|
||||||
# REMOVED pip install fhirpath from this line
|
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash - \
|
||||||
RUN npm install -g gofsh fsh-sushi
|
&& apt-get install -y --no-install-recommends nodejs \
|
||||||
|
&& npm install -g gofsh fsh-sushi \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# Set up Python environment
|
# Set workdir
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN python3 -m venv /app/venv
|
|
||||||
ENV PATH="/app/venv/bin:$PATH"
|
|
||||||
|
|
||||||
# ADDED: Uninstall old fhirpath just in case it's in requirements.txt
|
# Copy requirements and install Python dependencies
|
||||||
RUN pip uninstall -y fhirpath || true
|
|
||||||
# ADDED: Install the new fhirpathpy library
|
|
||||||
RUN pip install --no-cache-dir fhirpathpy
|
|
||||||
|
|
||||||
# Copy Flask files
|
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
# Install requirements (including Pydantic - check version compatibility if needed)
|
RUN python -m venv /app/venv \
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
&& . /app/venv/bin/activate \
|
||||||
|
&& pip install --upgrade pip \
|
||||||
|
&& pip install --no-cache-dir -r requirements.txt \
|
||||||
|
&& pip uninstall -y fhirpath || true \
|
||||||
|
&& pip install --no-cache-dir fhirpathpy \
|
||||||
|
&& pip install supervisor
|
||||||
|
|
||||||
|
# Copy application files
|
||||||
COPY app.py .
|
COPY app.py .
|
||||||
COPY services.py .
|
COPY services.py .
|
||||||
COPY forms.py .
|
COPY forms.py .
|
||||||
@ -33,15 +54,13 @@ COPY package.py .
|
|||||||
COPY templates/ templates/
|
COPY templates/ templates/
|
||||||
COPY static/ static/
|
COPY static/ static/
|
||||||
COPY tests/ tests/
|
COPY tests/ tests/
|
||||||
|
|
||||||
# Install supervisord
|
|
||||||
RUN pip install supervisor
|
|
||||||
|
|
||||||
# Configure supervisord
|
|
||||||
COPY supervisord.conf /etc/supervisord.conf
|
COPY supervisord.conf /etc/supervisord.conf
|
||||||
|
|
||||||
# Expose ports
|
# Expose ports
|
||||||
EXPOSE 5000 8080
|
EXPOSE 5000 8080
|
||||||
|
|
||||||
|
# Set environment
|
||||||
|
ENV PATH="/app/venv/bin:$PATH"
|
||||||
|
|
||||||
# Start supervisord
|
# Start supervisord
|
||||||
CMD ["supervisord", "-c", "/etc/supervisord.conf"]
|
CMD ["supervisord", "-c", "/etc/supervisord.conf"]
|
||||||
Loading…
x
Reference in New Issue
Block a user