1 Commits
Author SHA1 Message Date
tiutriumov.sm dc098626e0 Merge branch 'feature/ci-cd' into 'main'
Feature/ci cd

See merge request tiutriumov.sm/sample-project!1
2024-05-18 21:23:30 +00:00
4 changed files with 20 additions and 89 deletions
+20 -29
View File
@@ -1,33 +1,24 @@
stages:
- build
- push
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""
DOCKER_HOST: tcp://docker:2375/
DOCKER_USERNAME: serjiomarello
DOCKER_PASSWORD: TaReMona225657
services:
- name: docker:dind
command: ["--privileged"]
before_script:
- docker info
build_container:
build-job:
stage: build
image: docker:19.03.12
script:
- docker build -t $CI_REGISTRY_IMAGE/my-container:latest .
- docker tag $CI_REGISTRY_IMAGE/my-container:latest $CI_REGISTRY_IMAGE/my-container:$CI_COMMIT_SHORT_SHA
- echo "Hello, $GITLAB_USER_LOGIN!"
push_container:
stage: push
image: docker:19.03.12
test-job1:
stage: test
script:
- echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin $CI_REGISTRY
- docker push $CI_REGISTRY_IMAGE/my-container:latest
- docker push $CI_REGISTRY_IMAGE/my-container:$CI_COMMIT_#
- echo "This job tests something"
test-job2:
stage: test
script:
- echo "This job tests something, but takes more time than test-job1."
- echo "After the echo commands complete, it runs the sleep command for 20 seconds"
- echo "which simulates a test that runs 20 seconds longer than test-job1"
- sleep 20
deploy-prod:
stage: deploy
script:
- echo "This job deploys something from the $CI_COMMIT_BRANCH branch."
environment: production
-22
View File
@@ -1,22 +0,0 @@
#Front
FROM node:18-slim
WORKDIR /usr/local/app
COPY notes-app/package*.json ./
RUN npm i && npm cache clean --force
COPY notes-app/ .
RUN npm run build
#Backend
FROM node:18-slim
WORKDIR /usr/local/app
COPY notes-backend/package*.json ./
RUN npm i && npm cache clean --force
COPY notes-backend/ .
RUN npm run build
#nginx
FROM nginx:alpine
COPY nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=build-react /app/build /usr/share/nginx/html
COPY --from=build-node /app/dist /usr/share/nginx/html/api
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
-19
View File
@@ -1,19 +0,0 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["react"],
"rules": {
"react/prop-types": "off"
}
}
-19
View File
@@ -1,19 +0,0 @@
{
"env": {
"browser": true,
"es2021": true
},
"extends": ["eslint:recommended", "plugin:react/recommended"],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["react"],
"rules": {
"react/prop-types": "off"
}
}