docker/ui-nginx/Dockerfile
2019-02-12 13:57:18 -05:00

58 lines
1.9 KiB
Docker

FROM nginx:alpine
LABEL software.version="0.2.20190208"
EXPOSE 80
EXPOSE 22
EXPOSE 9000
COPY nginx.conf /etc/nginx/nginx.conf
COPY mime.types /etc/nginx/mime.types
RUN apk add nginx openssh yarn supervisor git \
&& rm /etc/nginx/conf.d/default.conf
#setup ssh
RUN echo 'root:odinlab' |chpasswd
RUN sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config \
&& sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config \
&& ssh-keygen -f /etc/ssh/ssh_host_rsa_key -N '' -t rsa \
&& ssh-keygen -f /etc/ssh/ssh_host_dsa_key -N '' -t dsa \
&& ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa \
&& ssh-keygen -f /etc/ssh/ssh_host_ed25519_key -N '' -t ed25519
ARG UI_BRANCH=master
ENV API_SCHEME=https
ENV API_SERVER=api.vizier.app
ENV API_PORT=443
ENV APP_PATH=""
ENV ANALYTICS_URL="https:\/\/analytics.vizier.app\/"
ENV ANALYTICS_SITE_ID=12a12e629ffb388167c2c3e560bbc8e1
#setup production web-ui branch
RUN mkdir /usr/local/source/ \
&& cd /usr/local/source/ \
&& echo 'test2' \
&& git clone https://github.com/VizierDB/web-ui.git \
&& cd /usr/local/source/web-ui \
&& git checkout -b local_$UI_BRANCH origin/$UI_BRANCH \
&& sed -i "s/'http:\/\/localhost:5000\/.*'/'$API_SCHEME:\/\/$API_SERVER:$API_PORT$APP_PATH'/g" /usr/local/source/web-ui/public/env.js \
&& yarn install
#hack where I used https://babeljs.io/repl to compile the two js
# files with e6 code to e5 for compliance with yarn build
COPY query-string-index.js /usr/local/source/web-ui/node_modules/query-string/index.js
COPY strict-uri-encode-index.js /usr/local/source/web-ui/node_modules/strict-uri-encode/index.js
RUN cd /usr/local/source/web-ui \
#&& cat ./node_modules/strict-uri-encode/index.js \
&& yarn build
COPY vizier.conf /etc/nginx/conf.d/vizier.conf
COPY entrypoint.sh /usr/local/entrypoint.sh
COPY supervisord.conf /etc/supervisord.conf
RUN chmod +x /usr/local/entrypoint.sh
ENTRYPOINT ["\/bin\/sh", "-c", "/usr/local/entrypoint.sh"]