Initial commit
This commit is contained in:
60
Dockerfile
Normal file
60
Dockerfile
Normal file
@@ -0,0 +1,60 @@
|
||||
FROM python:3.11-slim
|
||||
|
||||
# Set environment variables
|
||||
ENV PYTHONPATH=/app/src
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
# Install system dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
gcc \
|
||||
g++ \
|
||||
unixodbc-dev \
|
||||
curl \
|
||||
unzip \
|
||||
libaio-dev \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install Oracle Instant Client for cx_Oracle
|
||||
RUN mkdir -p /opt/oracle && \
|
||||
cd /opt/oracle && \
|
||||
curl -o instantclient-basic-linux.x64-21.9.0.0.0dbru.zip \
|
||||
https://download.oracle.com/otn_software/linux/instantclient/219000/instantclient-basic-linux.x64-21.9.0.0.0dbru.zip && \
|
||||
unzip instantclient-basic-linux.x64-21.9.0.0.0dbru.zip && \
|
||||
rm instantclient-basic-linux.x64-21.9.0.0.0dbru.zip && \
|
||||
cd instantclient_21_9 && \
|
||||
mkdir -p lib && \
|
||||
ln -s ../libclntsh.so.21.1 lib/libclntsh.so && \
|
||||
ln -s ../libnnz21.so lib/libnnz21.so && \
|
||||
ln -s ../libociicus.so lib/libociicus.so && \
|
||||
echo /opt/oracle/instantclient_21_9 > /etc/ld.so.conf.d/oracle-instantclient.conf && \
|
||||
ldconfig
|
||||
|
||||
# Set Oracle environment variables
|
||||
ENV ORACLE_HOME=/opt/oracle/instantclient_21_9
|
||||
ENV LD_LIBRARY_PATH=/opt/oracle/instantclient_21_9:$LD_LIBRARY_PATH
|
||||
ENV PATH=/opt/oracle/instantclient_21_9:$PATH
|
||||
|
||||
# Create app directory
|
||||
WORKDIR /app
|
||||
|
||||
# Copy requirements and install Python dependencies
|
||||
COPY requirements.txt .
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
# Copy application code
|
||||
COPY src/ ./src/
|
||||
|
||||
# Create logs directory
|
||||
RUN mkdir -p /app/logs
|
||||
|
||||
# Create non-root user
|
||||
RUN groupadd -r wxconnect && useradd -r -g wxconnect wxconnect
|
||||
RUN chown -R wxconnect:wxconnect /app
|
||||
USER wxconnect
|
||||
|
||||
# Health check
|
||||
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
|
||||
CMD python -c "import sys; sys.path.insert(0, '/app/src'); from wxconnect.config import Config; c = Config(); print('OK' if c.validate() else 'FAIL')" || exit 1
|
||||
|
||||
# Entry point
|
||||
CMD ["python", "-m", "wxconnect.main"]
|
||||
Reference in New Issue
Block a user