From f1cc366f11774b64bdfbb6a79300927cbef1aea9 Mon Sep 17 00:00:00 2001 From: Witalij Poljatchek Date: Wed, 10 Jan 2024 18:46:39 +0100 Subject: [PATCH] add push to jenkinsfile --- Dockerfile | 23 ++++++++++++----------- Dockerfile copy | 31 +++++++++++++++++++++++++++++++ Jenkinsfile | 10 ++++------ 3 files changed, 47 insertions(+), 17 deletions(-) create mode 100644 Dockerfile copy diff --git a/Dockerfile b/Dockerfile index 9779cd8..d27c94f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,16 @@ -FROM ubuntu:22.04 +FROM node:20-bullseye AS build -USER root +RUN node -v + +# make the 'app' folder the current working directory +WORKDIR /app + +COPY . . +FROM nginx +COPY --from=build /app/build/ /usr/share/nginx/html/ + +RUN rm /etc/nginx/conf.d/default.conf +COPY _nginx/nginx.conf /etc/nginx/conf.d -RUN apt-get update ;\ - apt-get -y install lsb-release procps wget sudo git apt-transport-https ca-certificates curl gnupg2 software-properties-common -RUN curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg ;\ - echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian bookworm stable" | sudo tee /etc/apt/sources.list.d/docker.list ;\ - apt-get update ;\ - apt-get -y install docker-ce docker-ce-cli docker-ce-rootless-extras docker-buildx-plugin -RUN sudo curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh ;\ - sudo bash nodesource_setup.sh ;\ - apt-get -y install nodejs diff --git a/Dockerfile copy b/Dockerfile copy new file mode 100644 index 0000000..65863ba --- /dev/null +++ b/Dockerfile copy @@ -0,0 +1,31 @@ +FROM node:20-bullseye AS build + +RUN node -v + +# make the 'app' folder the current working directory +WORKDIR /app + +COPY . . +FROM nginx +COPY --from=build /app/build/ /usr/share/nginx/html/ + +RUN rm /etc/nginx/conf.d/default.conf +COPY _nginx/nginx.conf /etc/nginx/conf.d + + + +FROM ubuntu:22.04 + +USER root + +RUN apt-get update ;\ + apt-get -y install lsb-release procps wget sudo git apt-transport-https ca-certificates curl gnupg2 software-properties-common + +RUN curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg ;\ + echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian bookworm stable" | sudo tee /etc/apt/sources.list.d/docker.list ;\ + apt-get update ;\ + apt-get -y install docker-ce docker-ce-cli docker-ce-rootless-extras docker-buildx-plugin + +RUN sudo curl -sL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh ;\ + sudo bash nodesource_setup.sh ;\ + apt-get -y install nodejs diff --git a/Jenkinsfile b/Jenkinsfile index 9e419b1..26be5ea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -10,18 +10,16 @@ pipeline { sh ''' npm install npm run build - echo "-------" - #sudo docker build -t bbuddy/bbuddy_backend-dev:latest . + sudo docker build -t bbuddy/bbuddy_ui:latest . ''' } } stage('Push image to harbor ') { steps { sh ''' - # - #sudo docker login https://harbor-wtkp3fsbv6.vertexa.devbay.tech/ -u 'robot$jenkins' -p 'ZrzsVIAeueW1p0alpAnPfM5CDtaRVVKz' - #sudo docker tag bbuddy/bbuddy_backend-dev:1.0.0 harbor-wtkp3fsbv6.vertexa.devbay.tech/bbuddy/bbuddy-ui:latest - #sudo docker push harbor-wtkp3fsbv6.vertexa.devbay.tech/bbuddy/bbuddy-ui:latest + sudo docker login https://harbor-wtkp3fsbv6.vertexa.devbay.tech/ -u 'robot$jenkins' -p 'ZrzsVIAeueW1p0alpAnPfM5CDtaRVVKz' + sudo docker tag bbuddy/bbuddy_ui:latest harbor-wtkp3fsbv6.vertexa.devbay.tech/bbuddy/bbuddy_ui:latest + sudo docker push harbor-wtkp3fsbv6.vertexa.devbay.tech/bbuddy/bbuddy-ui:latest ''' }