From c27227cc7184b524deab92023ebdbb89917b6333 Mon Sep 17 00:00:00 2001 From: Victor Martin Date: Wed, 28 Aug 2024 19:43:06 +0200 Subject: [PATCH] fix dockerfile for app in multi stange container --- app/Dockerfile | 28 +++++++++++++++------------- deploy/k8s/app/app.yaml | 1 + 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/app/Dockerfile b/app/Dockerfile index 09c06581..ebdd22ae 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -1,23 +1,25 @@ -FROM nginx:1.23-alpine-slim +FROM --platform=linux/amd64 node:18-slim AS builder -RUN apk add --update nodejs npm +WORKDIR /usr/src/app -WORKDIR /usr/share/build +RUN mkdir -p ./src \ + && mkdir -p ./scripts \ + && mkdir -p ./staged-themes -RUN mkdir -p /usr/share/build/src \ - && mkdir -p /usr/share/build/scripts +COPY src/ ./src/ +COPY staged-themes/ ./staged-themes +COPY scripts/ ./scripts/ +COPY *.json ./ -COPY src/ /usr/share/build/src/ - -COPY scripts/ /usr/share/build/scripts/ - -COPY *.json /usr/share/build/ +RUN rm package-lock.json +RUN npm install -g @oracle/ojet-cli@16.1.0 RUN npm install -RUN npm install -g @oracle/ojet-cli -RUN ojet build web --release +RUN ojet build web --release + +FROM --platform=linux/amd64 nginx:1.23-alpine-slim -RUN cp -R /usr/share/build/web/* /usr/share/nginx/html/ +COPY --from=builder /usr/src/app/web/* /usr/share/nginx/html/ EXPOSE 80 diff --git a/deploy/k8s/app/app.yaml b/deploy/k8s/app/app.yaml index 2a8c9070..61f7b972 100644 --- a/deploy/k8s/app/app.yaml +++ b/deploy/k8s/app/app.yaml @@ -21,6 +21,7 @@ spec: spec: containers: - image: app + imagePullPolicy: "Always" name: app readinessProbe: httpGet: