This commit is contained in:
Gary Kwok
2024-03-11 15:20:47 +08:00
parent f49cfc64d9
commit 983889b813
20 changed files with 5352 additions and 11 deletions

View File

@@ -42,10 +42,15 @@ registryPass: "P@ssw0rd"
imagePullDomain: "pvgharbor.duckdns.org"
# The configuration
demolamp:
imageName: "{{ imagePullDomain }}/demolamp/demolamp"
pushRepoName: "{{ imagePushDomain }}/demolamp/demolamp"
dockerFile: "Dockerfile_demolamp.yml"
pvgnginx:
imageName: "{{ imagePullDomain }}/pvgnginx/pvgnginx"
pushRepoName: "{{ imagePushDomain }}/pvgnginx/pvgnginx"
dockerFile: "Dockerfile_nginx.yml"
pvgphpfpm:
imageName: "{{ imagePullDomain }}/pvgphpfpm/pvgphpfpm"
pushRepoName: "{{ imagePushDomain }}/pvgphpfpm/pvgphpfpm"
dockerFile: "Dockerfile_phpfpm.yml"
# Update the docker-compose file (var=fileCompose) every execution.
# true: Ansible will use template module to transfer the file.

View File

@@ -15,18 +15,24 @@
- name: git clone
git:
repo: "https://pvggitea.duckdns.org/GiteaTeam/demolamp.git"
repo: "https://pvggitea.duckdns.org/GiteaTeam/demolampswarm.git"
dest: "{{ pathTemp }}"
remote: "origin"
version: "main"
- name: Remove the docker image for demolamp if exists
- name: Remove the docker image for pvgnginx if exists
community.docker.docker_image:
name: "{{ demolamp.imageName }}"
name: "{{ pvgnginx.imageName }}"
tag: "{{ ansTagVer }}"
state: absent
- name: Docker login to ECV private repository if not pull from local registry
- name: Remove the docker image for pvgphpfpm if exists
community.docker.docker_image:
name: "{{ pvgphpfpm.imageName }}"
tag: "{{ ansTagVer }}"
state: absent
- name: Docker login to PVG private repository if not pull from local registry
community.docker.docker_login:
registry: "{{ imagePushDomain }}"
username: "{{ registryUser }}"
@@ -34,17 +40,30 @@
state: present
when: not localRegistry | bool
- name: Build demolamp image
- name: Build Nginx image
community.docker.docker_image:
name: "{{ demolamp.imageName }}"
name: "{{ pvgnginx.imageName }}"
source: build
tag: "{{ ansTagVer }}"
build:
path: "{{ pathTemp }}"
pull: false
push: yes
repository: "{{ demolamp.pushRepoName }}:{{ ansTagVer }}"
repository: "{{ pvgnginx.pushRepoName }}:{{ ansTagVer }}"
force_tag: yes
timeout: 300
state: present
- name: Build pvgphpfpm image
community.docker.docker_image:
name: "{{ pvgphpfpm.imageName }}"
source: build
tag: "{{ ansTagVer }}"
build:
path: "{{ pathTemp }}"
pull: false
push: yes
repository: "{{ pvgphpfpm.pushRepoName }}:{{ ansTagVer }}"
force_tag: yes
timeout: 300
state: present