Skip to content
Snippets Groups Projects
Commit a75b2895 authored by Maxime Soudant's avatar Maxime Soudant
Browse files

suit deployment

parent 930f48f6
No related branches found
No related tags found
No related merge requests found
Pipeline #28403 failed
stages:
- "build"
- "deploy"
docker-build: docker-build:
# Use the official docker image. # Use the official docker image.
image: docker:latest image: docker:latest
...@@ -27,6 +31,7 @@ docker-build: ...@@ -27,6 +31,7 @@ docker-build:
deploy_prod: deploy_prod:
stage: deploy stage: deploy
image: ansible/ansible:latest
script: script:
- echo "Deploy to production server" - echo "Deploy to production server"
environment: environment:
...@@ -34,4 +39,4 @@ deploy_prod: ...@@ -34,4 +39,4 @@ deploy_prod:
url: http://172.28.100.149:443 url: http://172.28.100.149:443
rules: rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: manual when: on_success
\ No newline at end of file \ No newline at end of file
version: '3'
services:
application:
image: 'maximesoudant/application_web_devops_m2:latest'
container_name: 'application'
ports:
- "443:443"
restart: unless-stopped
...@@ -2,6 +2,7 @@ version: '3' ...@@ -2,6 +2,7 @@ version: '3'
services: services:
gitlab-runner: gitlab-runner:
image: 'gitlab/gitlab-runner:latest' image: 'gitlab/gitlab-runner:latest'
container_name: 'gitlab_runner'
volumes: volumes:
- /var/run/docker.sock:/var/run/docker.sock - /var/run/docker.sock:/var/run/docker.sock
- ./config:/etc/gitlab-runner - ./config:/etc/gitlab-runner
......
...@@ -71,16 +71,20 @@ ...@@ -71,16 +71,20 @@
become: true become: true
tasks: tasks:
- name: Container node-web-app - name: Create application directory if it does not exist
community.docker.docker_container: ansible.builtin.file:
name: node-web-app path: ./application
image: maximesoudant/application_web_devops_m2 state: directory
state: started
restart_policy: always - name: Copy docker-compose.yml file
ports: copy:
- "443:443" src: ./application/docker-compose.yml
pull: true dest: ./application/docker-compose.yml
container_default_behavior: compatibility
- name: Launch docker_compose
community.docker.docker_compose:
project_src: ./application/
state: present
- name: gitlab runner - name: gitlab runner
hosts: Git_vm hosts: Git_vm
...@@ -95,7 +99,7 @@ ...@@ -95,7 +99,7 @@
- name: Copy docker-compose.yml file - name: Copy docker-compose.yml file
copy: copy:
src: ../gitlab/docker-compose.yml src: ./gitlab/docker-compose.yml
dest: ./gitlab/docker-compose.yml dest: ./gitlab/docker-compose.yml
- name: Launch docker_compose - name: Launch docker_compose
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment