Trying to fix basic functionality again.
This commit is contained in:
70
Dockerfile
Normal file
70
Dockerfile
Normal file
@@ -0,0 +1,70 @@
|
||||
FROM eclipse-temurin:17-jdk
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install Python and dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
python3 \
|
||||
python3-pip \
|
||||
python3-venv \
|
||||
git \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Set up Python virtual environment
|
||||
RUN python3 -m venv /opt/venv
|
||||
ENV PATH="/opt/venv/bin:$PATH"
|
||||
|
||||
# Install Anthropic and tqdm in the virtual environment
|
||||
RUN pip3 install --no-cache-dir "anthropic>=0.8.1,<0.9.0" tqdm==4.66.2 python-dotenv==1.0.1
|
||||
|
||||
# Clone the official Synthea repository directly into /app
|
||||
RUN git clone https://github.com/synthetichealth/synthea.git /app-temp && \
|
||||
cp -r /app-temp/* /app/ && \
|
||||
rm -rf /app-temp
|
||||
|
||||
# Create directory structure for our custom modules and python scripts
|
||||
RUN mkdir -p /app/module_generator \
|
||||
/app/output \
|
||||
/app/src/main/resources/modules
|
||||
|
||||
# First build the project with the official modules - this will compile the Java code
|
||||
RUN ./gradlew build -x test
|
||||
|
||||
# Make the run_synthea script executable
|
||||
RUN chmod +x /app/run_synthea
|
||||
|
||||
# Copy our Python scripts and module generators
|
||||
COPY module_generator/*.py /app/module_generator/
|
||||
COPY src/main/resources/modules/* /app/src/main/resources/modules/
|
||||
COPY src/main/resources/disease/* /app/src/main/resources/
|
||||
COPY scripts/* /app/scripts/
|
||||
|
||||
# Make scripts executable
|
||||
RUN chmod +x /app/module_generator/*.py /app/scripts/*
|
||||
|
||||
# Verify and fix module JSON structures
|
||||
RUN python3 /app/scripts/check_condition_structure.py --modules_dir /app/src/main/resources/modules --verbose
|
||||
# Create a directory for modules that will be mounted from the host
|
||||
RUN mkdir -p /app/modules
|
||||
|
||||
# Test a simple module generation to ensure Synthea works
|
||||
RUN ./run_synthea -p 1 -m hypertension
|
||||
|
||||
# Set up a symlink from mounted modules to Synthea modules directory
|
||||
RUN echo '#!/bin/sh\n\
|
||||
# Update modules symlinks\n\
|
||||
# Load environment variables\n\
|
||||
if [ -f /app/.env ]; then\n\
|
||||
export $(grep -v "^#" /app/.env | xargs)\n\
|
||||
fi\n\
|
||||
\n\
|
||||
exec "$@"' > /app/entrypoint.sh && chmod +x /app/entrypoint.sh
|
||||
|
||||
# Set PYTHONPATH to ensure modules can be found
|
||||
ENV PYTHONPATH="/app"
|
||||
|
||||
# Set entrypoint to use our script
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
|
||||
# Default command when container runs
|
||||
CMD ["tail", "-f", "/dev/null"]
|
||||
Reference in New Issue
Block a user