From a3c89245b46ee74466757cae0c1a7b288c10d09d Mon Sep 17 00:00:00 2001 From: Drew Bednar Date: Sun, 14 Nov 2021 13:47:04 -0500 Subject: [PATCH] preparing for adding frontend --- Makefile | 21 +++++++++++++++------ app/app/.dockerignore | 4 ++++ app/app/Dockerfile | 15 +++++++++++++++ charts/demo-helm/values.yaml | 6 +++++- 4 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 app/app/.dockerignore create mode 100644 app/app/Dockerfile diff --git a/Makefile b/Makefile index d4a9ff6..cb26f04 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,21 @@ - -IMAGE_NAME=registry.runcible.io/demo-helm -IMAGE_VERSION=1.1.0 +REGISTRY_NAME=registry.runcible.io +FRONTEND_IMAGE_NAME=$(REGISTRY_NAME)/demo-helm-frontend +FRONTEND_IMAGE_VERSION=1.1.0 +BACKEND_IMAGE_NAME=$(REGISTRY_NAME)/demo-helm-backend +BACKEND_IMAGE_VERSION=1.1.0 push-app-image: build-app-image - docker push $(IMAGE_NAME):$(IMAGE_VERSION) + docker push $(FRONTEND_IMAGE_NAME):$(FRONTEND_IMAGE_VERSION) build-app-image: - docker build -t $(IMAGE_NAME):$(IMAGE_VERSION) ./app/backend + docker build -t $(FRONTEND_IMAGE_NAME):$(FRONTEND_IMAGE_VERSION) ./app/app + +push-backend-image: build-backend-image + docker push $(BACKEND_IMAGE_NAME):$(BACKEND_IMAGE_VERSION) + +build-backend-image: + docker build -t $(BACKEND_IMAGE_NAME):$(BACKEND_IMAGE_VERSION) ./app/backend check: - echo $(IMAGE_NAME):$(IMAGE_VERSION) \ No newline at end of file + echo $(FRONTEND_IMAGE_NAME):$(FRONTEND_IMAGE_VERSION) + echo $(BACKEND_IMAGE_NAME):$(BACKEND_IMAGE_VERSION) diff --git a/app/app/.dockerignore b/app/app/.dockerignore new file mode 100644 index 0000000..512c26d --- /dev/null +++ b/app/app/.dockerignore @@ -0,0 +1,4 @@ +node_modules +.git +.gitignore +.vscode \ No newline at end of file diff --git a/app/app/Dockerfile b/app/app/Dockerfile new file mode 100644 index 0000000..cff2fd0 --- /dev/null +++ b/app/app/Dockerfile @@ -0,0 +1,15 @@ +# build stage +# node:14.18.0-alpine is lts-alpine as of 10/12/2021 +FROM node:14.18.0-alpine as build-stage +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +RUN npm run build + +# production stage +# nginx:1.20.1-alpine is nginx-stable as of 10/12/2021 +FROM nginx:1.20.1-alpine as production-stage +COPY --from=build-stage /app/dist /usr/share/nginx/html +EXPOSE 80 +CMD ["nginx", "-g", "daemon off;"] \ No newline at end of file diff --git a/charts/demo-helm/values.yaml b/charts/demo-helm/values.yaml index c149ca6..8b29763 100644 --- a/charts/demo-helm/values.yaml +++ b/charts/demo-helm/values.yaml @@ -1,7 +1,11 @@ --- image_pull_secret: regcred services: + frontend: + image_name: "registry.runcible.io/demo-helm-frontend" + image_version: "1.1.0" + replicas: 1 backend: - image_name: "registry.runcible.io/demo-helm" + image_name: "registry.runcible.io/demo-helm-backend" image_version: "1.1.0" replicas: 1