Build frontend code in sqkserver dockerfile (#317)

This commit is contained in:
Jonathan Zernik 2020-10-24 11:31:10 -04:00 committed by GitHub
parent f321785d60
commit ce31be284d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 4 deletions

View file

@ -1,8 +1,6 @@
#FROM node:10-stretch
FROM ubuntu:20.04
ARG PORT
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -qq update && apt-get -qq install -y \
@ -42,7 +40,6 @@ RUN chmod +x pb_disable-eslint.sh && \
./pb_disable-eslint.sh src/proto/
RUN npm install && \
REACT_APP_PORT=${PORT} \
npm run build
EXPOSE 8081

View file

@ -1,11 +1,55 @@
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get -qq update && apt-get -qq install -y \
curl \
unzip \
nodejs \
npm \
git \
git-core
RUN npm install -g serve
WORKDIR /tmp
RUN curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v3.12.2/\
protoc-3.12.2-linux-x86_64.zip -o protoc.zip && \
unzip -qq protoc.zip && \
cp ./bin/protoc /usr/local/bin/protoc
RUN curl -sSL https://github.com/grpc/grpc-web/releases/download/1.2.0/\
protoc-gen-grpc-web-1.2.0-linux-x86_64 -o /usr/local/bin/protoc-gen-grpc-web && \
chmod +x /usr/local/bin/protoc-gen-grpc-web
COPY frontend/squeak-node-frontend .
# Copy the proto files
COPY proto/* src/proto/
RUN cd src && \
protoc -I=. proto/squeak_admin.proto proto/lnd.proto \
--js_out=import_style=commonjs:. \
--grpc-web_out=import_style=commonjs,mode=grpcwebtext:.
# Copy the eslint prepend script.
COPY "docker/frontend/pb_disable-eslint.sh" .
RUN chmod +x pb_disable-eslint.sh && \
./pb_disable-eslint.sh src/proto/
RUN npm install && \
npm run build
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
python3-pip \
python3-psycopg2 \
git
WORKDIR /
COPY requirements.txt /
RUN pip3 install --upgrade pip && \
@ -22,7 +66,9 @@ COPY proto ./proto
COPY setup.py setup.cfg MANIFEST.in README.md ./
# Copy the frontend code
COPY frontend/squeak-node-frontend/build/ ./static/build
# COPY frontend/squeak-node-frontend/build/ ./static/build
RUN mkdir ./static && \
cp -r /tmp/build ./static/build
RUN python3 setup.py install