Skip to content

Commit

Permalink
testing dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
havok2063 committed Feb 15, 2024
1 parent a6a1e01 commit 457b37b
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
58 changes: 58 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Use an official Python runtime as a parent image
FROM python:3.10-slim

# Set the working directory in the container
WORKDIR /app

# Install git
RUN apt-get update && \
apt-get install -y git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Clone the repository and checkout the specific tag
# RUN git clone https://github.com/sdss/marvin.git /app && \
# git checkout tags/2.8.0
COPY . /app

#RUN pip install "psycopg2<2.9"
#RUN pip install psycopg2-binary

# Install deps for psycopg2
RUN apt-get update \
&& apt-get -y install libpq-dev gcc \
&& pip install psycopg2


# Install any needed packages
RUN pip install --no-cache-dir ".[web,db]"

# Install uWSGI
RUN pip install gunicorn uvicorn
RUN pip install "jinja2<3.1"
RUN pip install "packaging<21"
RUN pip install "itsdangerous==2.0.1"
RUN pip install "pillow<10"

# Create the log directory and ensure it's writable
RUN mkdir -p /tmp/marvin/logs && \
chmod -R 755 /tmp/marvin

# Make port 8000 available to the world outside this container
EXPOSE 8000

# Copy your uWSGI ini file into the container
#COPY python/marvin/web/uwsgi_conf_files/docker.py /app/python/marvin/web/uwsgi_conf_files/docker.py

RUN mkdir -p /root/.marvin && chmod -R 755 /root/.marvin
RUN echo "use_sentry: False\nadd_github_message: False\ncheck_access: False" > /root/.marvin/marvin.yml

ENV FLASK_ENV=docker
ENV FLASK_APP="marvin.web.uwsgi_conf_files.app:app"

WORKDIR /app/python

# Run the application with uWSGI
#CMD ["uwsgi", "--ini", "/app/python/marvin/web/uwsgi_conf_files/docker.ini"]
#CMD ["gunicorn", "-w", "1", "-b", ":8000", "marvin.web.uwsgi_conf_files.app:app"]
CMD ["gunicorn", "-c", "/app/python/marvin/web/uwsgi_conf_files/docker.py", "marvin.web.uwsgi_conf_files.app:app"]
9 changes: 9 additions & 0 deletions python/marvin/web/uwsgi_conf_files/docker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import os

socket_dir = os.getenv("MARVIN_SOCKET_DIR", '/tmp/marvin')
bind = [f"unix:{socket_dir}/marvin.sock", "0.0.0.0:8000"]
workers = 1
daemon = False
errorlog = os.path.join(os.getenv("MARVIN_LOGS_DIR", '/tmp/marvin/logs'), 'marvin_app_error.log')
accesslog = os.path.join(os.getenv("MARVIN_LOGS_DIR", '/tmp/marvin/logs'), 'marvin_app_access.log')
root_path = '/marvin'

0 comments on commit 457b37b

Please sign in to comment.