| # Copyright 2019 The Chromium OS Authors. All rights reserved. | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| ARG BASE_REGISTRY_URI=us-docker.pkg.dev/chromeos-partner-moblab/base-containers | |
| ARG REGISTRY_URI=gcr.io/chromeos-partner-moblab | |
| ARG LABEL=autopush | |
| ###################################################################### | |
| FROM ${BASE_REGISTRY_URI}/node:24 AS build | |
| # install chrome for protractor tests | |
| # RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - | |
| # RUN sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' | |
| # RUN apt-get update && apt-get install -yq google-chrome-stable | |
| WORKDIR /app | |
| # install and cache app dependencies | |
| COPY ./satlab-ui/package.json /app | |
| COPY ./satlab-ui/package-lock.json /app | |
| RUN npm ci --ignore-scripts | |
| # add `/app/node_modules/.bin` to $PATH | |
| ENV PATH /app/node_modules/.bin:$PATH | |
| # add app | |
| COPY ./satlab-ui /app | |
| # run tests | |
| #RUN ng test --watch=false | |
| #RUN ng e2e --port 4202 | |
| RUN ng build --output-path=dist --output-hashing=all --configuration=production | |
| ###################################################################### | |
| # base image | |
| FROM ${BASE_REGISTRY_URI}/nginx:alpine | |
| ARG UID=246 | |
| RUN addgroup --gid $UID moblab && adduser --ingroup moblab --uid $UID \ | |
| --disabled-password --gecos "" moblab | |
| RUN mkdir -p /var/cache/nginx/client_temp | |
| RUN mkdir -p /var/cache/nginx/proxy_temp | |
| RUN chown -R moblab /var/cache/nginx | |
| RUN chmod -R uog+rw /var/run | |
| # copy artifact build from the 'build environment' | |
| COPY --chown=moblab --from=build /app/dist/browser /etc/nginx/html/ | |
| COPY --chown=moblab --from=build /app/dist/3rdpartylicenses.txt /etc/nginx/html/ | |
| COPY --chown=moblab satlab-ui/nginx.conf /etc/nginx | |
| RUN rm -f /etc/nginx/conf.d/* | |
| RUN rm -f /docker-entrypoint.d/* | |
| RUN rm -f /var/log/nginx/* | |
| RUN chmod uog+rw /var/log/nginx | |
| RUN chown -R moblab:moblab /var/log/nginx | |
| EXPOSE 6010 | |
| USER moblab | |
| # run nginx | |
| CMD ["nginx", "-g", "daemon off;"] | |