Skip to content

dockerfile added #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Utiliser l'image Apache officielle
FROM httpd:2.4

# Supprimer le contenu par défaut d'Apache (optionnel)
RUN rm -rf /usr/local/apache2/htdocs/*

# Copier tout ton site dans le dossier d’Apache
COPY . /usr/local/apache2/htdocs/

# Exposer le port 80
EXPOSE 80
# coucou
47 changes: 47 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
pipeline {
agent any

stages{
//------------------------------------------------
stage('Generate Local Tag') {
steps {
script {
def shortHash = sh(script: 'git rev-parse --short HEAD', returnStdout: true).trim()
def timestamp = new Date().format('yyyyMMddHHmmss')
env.LOCAL_TAG = "v${timestamp}-${shortHash}"

echo "Generated Local Tag: ${env.LOCAL_TAG}"
}
}
}

//------------------------------------------------

stage('Docker Build & Push') {
steps {
withCredentials([string(credentialsId: 'Bolverkr14', variable: 'bolverkr_pw')]) {
echo "print tag : $LOCAL_TAG"
sh 'docker login -u attilaisnotdead -p $bolverkr_pw'
sh 'docker build -t attilaisnotdead/websiteyann:$LOCAL_TAG .'
sh 'docker push attilaisnotdead/websiteyann:$LOCAL_TAG'
}
}
}

//------------------------------------------------

stage(' Deployment docker ') {
steps {

script {
sh 'sudo docker ps -a --filter "name=attilaisnotdead" --format "{{.ID}}" |sudo xargs -r docker stop'
sh 'sudo docker ps -a --filter "name=attilaisnotdead" --format "{{.ID}}" |sudo xargs -r docker rm'
sh 'docker run -d -p 9999:80 --name attilaisnotdead$LOCAL_TAG attilaisnotdead/websiteyann:$LOCAL_TAG'
}

}
}
//------------------------------------------------
}

}
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>My Website</title>
<title>CEST AMOI CE BEAU SITE</title>
</head>

<body>
Expand Down