Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker paolo #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM mambaorg/micromamba:0.14.0

RUN apt-get update

COPY environment.yml /tmp/environment.yaml

RUN micromamba env create -f /tmp/environment.yaml && \
micromamba clean --all --yes

COPY ./ /home/docker/api
COPY .env /home/docker/api/.env

RUN useradd -ms /bin/bash docker
WORKDIR /home/docker
USER docker

ENV PATH="/opt/conda/envs/ptox/bin:$PATH"

#CMD ["bash"]

RUN /bin/bash -c "micromamba activate ptox"

WORKDIR "/home/docker/api"

#CMD [ "flask", "run" ]

CMD ["uwsgi", "app.ini"]

25 changes: 25 additions & 0 deletions app.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[uwsgi]
# the module itself, by referring to the wsgi.py file minus the extension, and the callable within the file, app:
module = wsgi:app

# Enable hot reload!
py-autoreload = 1

# Nginx to handle actual client connections, which will then pass requests to uWSGI.
socket = /tmp/mysite.sock
# socket = :80


master = false
processes = 1
cheaper = 0
lazy-apps = true
threads = 2

# giving the Nginx group ownership of the uWSGI process later on,
# so we need to make sure the group owner of the socket can read information from it and write to it.
chmod-socket = 660

# clean up the socket when the process stops by adding the vacuum option:
vacuum = true
die-on-term = true
18 changes: 18 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: ptox
channels:
- conda-forge
dependencies:
- python=3.8.1
- psycopg2~=2.9.3
- Flask~=2.1.1
- python-dotenv
- graphene>=3.0
- sqlparse>=0.3.0
- Pygments>=2.0.1
- flask-cors>=3.0.2
- uwsgi==2.0.20





6 changes: 6 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
app="docker.test"
docker build -t ${app} .
docker run -d -p 56733:5000 \
--name=${app} \
-v $PWD:/app ${app}
4 changes: 4 additions & 0 deletions wsgi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from app import app

if __name__ == "__main__":
app.run()