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

deployment fixes for web app build #640

Draft
wants to merge 8 commits into
base: development
Choose a base branch
from
Draft
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
27 changes: 26 additions & 1 deletion www/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# syntax=docker/dockerfile:1

# ####################
# Web App - Build
# ####################
FROM node:16.8.0 as builder

ARG API_ENDPOINT

WORKDIR /usr/src/react_web_app
# copy npm package and lock file
COPY frontends/compiler_gym/package.json frontends/compiler_gym/package-lock.json ./
RUN --mount=type=cache,target=/usr/src/react_web_app/.npm --mount=type=cache,target=/usr/src/react_web_app/node_modules \
npm install

# copy remaining UI code.
COPY frontends/compiler_gym/public public
COPY frontends/compiler_gym/src src

# configure api endpoint
RUN echo REACT_APP_API_URL=${API_ENDPOINT} > .env.production

# Compile frontend
RUN --mount=type=cache,target=/usr/src/react_web_app/.npm --mount=type=cache,target=/usr/src/react_web_app/node_modules \
npm run build


FROM python:3.8-slim-buster

WORKDIR /app
Expand All @@ -23,6 +48,6 @@ RUN pip3 install --no-cache-dir -r requirements.txt
RUN python3 -m compiler_gym.bin.service --env=llvm-v0

COPY www.py .
COPY frontends/compiler_gym/build frontends/compiler_gym/build
COPY --from=builder /usr/src/react_web_app/build frontends/compiler_gym/build

CMD [ "python3", "www.py"]
1 change: 1 addition & 0 deletions www/frontends/compiler_gym/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/node_modules
2 changes: 1 addition & 1 deletion www/frontends/compiler_gym/.env.production
Original file line number Diff line number Diff line change
@@ -1 +1 @@
REACT_APP_API_URL=http://18.219.131.236:5000
REACT_APP_API_URL=http://beanstalk-compiler-gym.eba-36iz7mga.us-east-2.elasticbeanstalk.com
4 changes: 2 additions & 2 deletions www/frontends/compiler_gym/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"web-vitals": "^1.1.2"
},
"scripts": {
"start": "react-scripts --openssl-legacy-provider start",
"build": "react-scripts --openssl-legacy-provider build",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Expand Down
5 changes: 5 additions & 0 deletions www/www.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,11 @@ class StepReply(BaseModel):
states: List[StateToVisualize]


@app.route("/health")
def healthy():
return {'message': 'Healthy'}


@app.route("/api/v4/describe")
def describe():
with env_lock:
Expand Down