build: refactor production containers
Production containers now copy the Zeppelin source files at build-time rather than using a shared volume. This means fewer permission issues and backend/dashboard builds only have to run once at build-time, not every time the containers are started. Docs in PRODUCTION.md have been updated accordingly.
This commit is contained in:
parent
b60a7fb145
commit
b67b3c35b7
8 changed files with 60 additions and 64 deletions
9
docker/production/backend/Dockerfile
Normal file
9
docker/production/backend/Dockerfile
Normal file
|
@ -0,0 +1,9 @@
|
|||
FROM node:18
|
||||
USER node
|
||||
|
||||
COPY --chown=node:node . /zeppelin
|
||||
|
||||
WORKDIR /zeppelin/backend
|
||||
RUN ls -lah
|
||||
RUN pwd
|
||||
RUN npm ci && npm run build
|
|
@ -1,3 +1,13 @@
|
|||
FROM node:18 AS builder
|
||||
USER node
|
||||
|
||||
COPY --chown=node:node . /zeppelin
|
||||
|
||||
WORKDIR /zeppelin/dashboard
|
||||
RUN ls -lah
|
||||
RUN pwd
|
||||
RUN npm ci && npm run build
|
||||
|
||||
FROM nginx
|
||||
|
||||
ARG API_PORT
|
||||
|
@ -6,6 +16,8 @@ ARG DOCKER_PROD_DOMAIN
|
|||
RUN apt-get update && apt-get install -y openssl
|
||||
RUN openssl req -x509 -newkey rsa:4096 -keyout /etc/ssl/private/zeppelin-self-signed-cert.key -out /etc/ssl/certs/zeppelin-self-signed-cert.pem -days 3650 -subj "/CN=${DOCKER_PROD_DOMAIN}" -nodes
|
||||
|
||||
COPY ./default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY ./docker/production/nginx/default.conf /etc/nginx/conf.d/default.conf
|
||||
RUN sed -ir "s/_API_PORT_/${API_PORT}/g" /etc/nginx/conf.d/default.conf
|
||||
RUN sed -ir "s/_DOCKER_PROD_DOMAIN_/${DOCKER_PROD_DOMAIN}/g" /etc/nginx/conf.d/default.conf
|
||||
|
||||
COPY --from=builder /zeppelin/dashboard/dist /var/www
|
||||
|
|
|
@ -3,7 +3,7 @@ server {
|
|||
listen [::]:443 ssl http2;
|
||||
server_name _DOCKER_PROD_DOMAIN_;
|
||||
|
||||
root /zeppelin/dashboard/dist;
|
||||
root /var/www;
|
||||
|
||||
location / {
|
||||
index index.html;
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
FROM node:18
|
||||
|
||||
ARG DOCKER_USER_UID
|
||||
ARG DOCKER_USER_GID
|
||||
|
||||
# This custom Dockerfile is needed for the Node image so we can change the uid/gid used for the node user
|
||||
# See https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md#non-root-user
|
||||
RUN groupmod -g "${DOCKER_USER_GID}" node && usermod -u "${DOCKER_USER_UID}" -g "${DOCKER_USER_GID}" node
|
||||
|
||||
USER node
|
Loading…
Add table
Add a link
Reference in a new issue