diff --git a/Dockerfile b/Dockerfile index d211e44..820ce10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,8 @@ -FROM jenkins/inbound-agent - -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 \ No newline at end of file +FROM node:bookworm AS build +RUN node -v +WORKDIR /app +COPY . . +FROM nginx +COPY --from=build /app/dist /usr/share/nginx/html/ +RUN rm /etc/nginx/conf.d/default.conf +COPY _nginx/nginx.conf /etc/nginx/conf.d \ No newline at end of file diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..2c6da33 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,29 @@ +pipeline { + agent { label 'jenkins-nodejs-agent' } + + + + + stages { + stage('Build static content') { + steps { + sh ''' + npm install + npm run build + pwd + echo + docker build --progress=plain -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_ui:latest harbor-wtkp3fsbv6.vertexa.devbay.tech/bbuddy/bbuddy_ui:latest + sudo docker push harbor-wtkp3fsbv6.vertexa.devbay.tech/bbuddy/bbuddy_ui:latest + ''' + } + } + } +} \ No newline at end of file diff --git a/_nginx/nginx.conf b/_nginx/nginx.conf new file mode 100644 index 0000000..4509e7a --- /dev/null +++ b/_nginx/nginx.conf @@ -0,0 +1,11 @@ +server { + listen 80; + location / { + root /usr/share/nginx/html; + index index.html index.htm; + try_files $uri $uri/ /index.html; } + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } +} \ No newline at end of file