Skip to content
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
32 changes: 21 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```