Last active
June 19, 2022 11:59
-
-
Save loujaybee/9fc041a5aa5f22103f4a1f3b6265feec to your computer and use it in GitHub Desktop.
ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
hosts: all | |
tasks: | |
- copy: ~ | |
dest: "." | |
name: "copy Dockerfile into remote machine" | |
src: Dockerfile | |
- copy: . | |
src: webapp.war | |
dest: "." | |
name: "copy .war file into remote machine" | |
- command: "Docker stop finalcontainer" | |
ignore_errors: true | |
name: "stop the running container" | |
- command: "Docker rm finalcontainer" | |
ignore_errors: true | |
name: "remove the running container" | |
- command: "Dockerfile rmi testimage" | |
ignore_errors: true | |
name: "remove the running image" | |
- command: "Docker build -t testimage ." | |
name: "create testimage from Dockerfile" | |
- command: "Docker run -d -p 8080:8080 --name finalcontainer testimage" | |
name: "create and run container" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment