ci\cd setup

This commit is contained in:
Skeris 2023-02-27 18:21:08 +03:00
parent 319152e36e
commit 409e14dfde
5 changed files with 73 additions and 0 deletions

31
.gitlab-ci.yml Normal file

@ -0,0 +1,31 @@
include:
- project: "devops/pena-continuous-integration"
file: "/templates/docker/build-template.gitlab-ci.yml"
- project: "devops/pena-continuous-integration"
file: "/templates/docker/clean-template.gitlab-ci.yml"
- project: "devops/pena-continuous-integration"
file: "/templates/docker/deploy-template.gitlab-ci.yml"
stages:
- clean
- build
- deploy
clear-old-images:
extends: .clean_template
variables:
STAGING_BRANCH: "main"
PRODUCTION_BRANCH: "main"
build-app:
extends: .build_template
variables:
DOCKER_BUILD_PATH: "./Dockerfile"
STAGING_BRANCH: "main"
PRODUCTION_BRANCH: "main"
deploy-to-staging:
extends: .deploy_template
variables:
DEPLOY_TO: "staging"
BRANCH: "main"

17
Dockerfile Normal file

@ -0,0 +1,17 @@
FROM node:19.1-alpine as build
RUN apk update && rm -rf /var/cache/apk/*
WORKDIR /usr/app
COPY package.json .
COPY tsconfig.json .
RUN yarn install --ignore-scripts --non-interactive --frozen-lockfile && yarn cache clean
COPY . .
RUN ls
RUN yarn build
FROM nginx:latest as result
WORKDIR /usr/share/nginx/html
COPY --from=build /usr/app/build/ /usr/share/nginx/html
COPY admin.conf /etc/nginx/conf.d/default.conf

12
admin.conf Normal file

@ -0,0 +1,12 @@
server {
listen 80;
server_name _;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
root /usr/share/nginx/html;
}

@ -0,0 +1,13 @@
version: "3.3"
services:
admin:
container_name: sedvices_front
restart: unless-stopped
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID
networks:
- marketplace_penahub_frontend
hostname: services
tty: true
networks:
marketplace_penahub_frontend:
external: true