vitess.io/vitess@v0.16.2/docker/k8s/vtadmin/Dockerfile (about)

     1  # Copyright 2022 The Vitess Authors.
     2  #
     3  # Licensed under the Apache License, Version 2.0 (the "License");
     4  # you may not use this file except in compliance with the License.
     5  # You may obtain a copy of the License at
     6  #
     7  #     http://www.apache.org/licenses/LICENSE-2.0
     8  #
     9  # Unless required by applicable law or agreed to in writing, software
    10  # distributed under the License is distributed on an "AS IS" BASIS,
    11  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  # See the License for the specific language governing permissions and
    13  # limitations under the License.
    14  
    15  ARG VT_BASE_VER=latest
    16  ARG DEBIAN_VER=bullseye-slim
    17  
    18  FROM vitess/k8s:${VT_BASE_VER} AS k8s
    19  
    20  FROM node:16-${DEBIAN_VER} as node
    21  
    22  # Prepare directory structure.
    23  RUN mkdir -p /vt/web
    24  
    25  # copy web admin files
    26  COPY --from=k8s /vt/web/vtadmin /vt/web/vtadmin
    27  
    28  # install/build/clean web dependencies
    29  RUN npm --prefix /vt/web/vtadmin ci && \
    30      npm run --prefix /vt/web/vtadmin build
    31  
    32  FROM nginxinc/nginx-unprivileged:1.22 AS nginx
    33  
    34  ENV VTADMIN_WEB_PORT=14201
    35  
    36  # Set up Vitess environment (just enough to run pre-built Go binaries)
    37  ENV VTROOT /vt
    38  
    39  # Copy binaries
    40  COPY --from=k8s /vt/bin/vtadmin /vt/bin/
    41  
    42  # Copy certs to allow https calls
    43  COPY --from=k8s /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
    44  
    45  COPY --chown=nginx --from=node /vt/web/vtadmin/build /var/www/
    46  COPY --chown=nginx default.conf /etc/nginx/templates/default.conf.template
    47  
    48  # command to run nginx is in the base image
    49  # https://github.com/nginxinc/docker-nginx-unprivileged/blob/main/stable/alpine/Dockerfile#L150