This commit is contained in:
Сюткина Дарья Александровна (4047910) 2024-01-17 18:42:05 +04:00
commit fcd103b8c8
3 changed files with 48 additions and 15 deletions

View File

@ -1,15 +1,8 @@
FROM jenkins/inbound-agent FROM node:bookworm AS build
RUN node -v
USER root WORKDIR /app
COPY . .
RUN apt-get update ;\ FROM nginx
apt-get -y install lsb-release procps wget sudo git apt-transport-https ca-certificates curl gnupg2 software-properties-common COPY --from=build /app/dist /usr/share/nginx/html/
RUN rm /etc/nginx/conf.d/default.conf
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg ;\ COPY _nginx/nginx.conf /etc/nginx/conf.d
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

29
Jenkinsfile vendored Normal file
View File

@ -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
'''
}
}
}
}

11
_nginx/nginx.conf Normal file
View File

@ -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;
}
}