diff --git a/Dockerfile b/Dockerfile index cd92391..93d52f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,27 @@ FROM python:2.7-alpine -WORKDIR /opt/pyast -ADD . /opt/pyast +RUN apk update && apk add \ + g++ \ + make \ + nodejs + +# apk does not install npm with nodejs since Alpine 3.6+ +RUN apk add --update nodejs-npm + +WORKDIR /opt/pyast/ +COPY requirements.txt . +RUN pip install -r requirements.txt -RUN apk update && \ - apk add g++ make && \ - apk add nodejs && \ - pip install -r requirements.txt && \ - cd /opt/pyast/front && \ - npm set progress=false && \ - npm install && \ - npm run build +WORKDIR /opt/pyast/front/ +COPY front/ . +RUN npm set progress=false +RUN npm install +RUN npm run build + +COPY app.py /opt/pyast/ +COPY parse.py /opt/pyast/ EXPOSE 4361 -CMD ["gunicorn", "app:app", "-w" "4", "-b", "'0.0.0.0:4361'"] +WORKDIR /opt/pyast +CMD ["gunicorn", "app:app", "-w", "4", "-b", "0.0.0.0:4361"] diff --git a/README.md b/README.md index fd18241..b6c803b 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,11 @@ The illustrous code behind [python-ast-explorer.com](https://python-ast-explorer ## Making sense of it See the `Dockerfile` for steps to get it up and running. It's basically a pretty bare `react-create-app` artifact that talks to a hacked up Flask app via repeated, desperate calls to `/api/_parse`. + +## Local development + +Run: +```bash +$ docker build -t aster27 . +$ docker run --rm -it -p 4361:4361 aster27 +```