Skip to content

Commit

Permalink
add Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
ltalirz authored and CasperWA committed Feb 6, 2020
1 parent ea975a2 commit 4358099
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 4 deletions.
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.7

WORKDIR /app

# copy repo contents
COPY setup.py README.md ./
COPY optimade ./optimade
RUN pip install -e .[mongo]
RUN pip install uvicorn

EXPOSE 80

ENV MAIN main

COPY run.sh ./

CMD ["/app/run.sh", "$MAIN"]
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '2'

services:
optimade-index:
restart: always
build:
context: .
dockerfile: Dockerfile
#environment:
# MAIN: main_index
ports:
- '3214:5000'
# - '3214:5001'
8 changes: 4 additions & 4 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
if [ "$1" == "index" ]
then
MAIN="main_index"
set -ex

if [ "${MAIN}" == "main_index" ]; then
PORT=5001
else
MAIN="main"
PORT=5000
fi

uvicorn optimade.server.$MAIN:app --reload --port $PORT
uvicorn optimade.server.$MAIN:app --reload --host 0.0.0.0 --port $PORT

0 comments on commit 4358099

Please sign in to comment.