diff --git a/.github/workflows/develop-workflow.yml b/.github/workflows/develop-workflow.yml new file mode 100644 index 0000000..3bb534e --- /dev/null +++ b/.github/workflows/develop-workflow.yml @@ -0,0 +1,78 @@ +name: Develop CI + +on: + push: + branches: + - develop + +jobs: + test-memory-2026: + name: Test JPEG files + runs-on: self-hosted + steps: + - uses: actions/checkout@v3 + + - name: Verify 'file' command + run: | + which file + + - name: Test and replace JPEGs + run: | + for f in $(git ls-files '*.jpg'); do + FILE_TYPE=$(file "$f") + if [[ "$FILE_TYPE" != *"JPEG image data"* ]]; then + cp html/replacement.jpg "$f" + fi + done + + - name: Commit replaced JPEGs + run: | + git config user.name "github-actions" + git config user.email "actions@github.com" + git add '*.jpg' + git commit -m "Remplacement JPEG corrompus" || echo "Rien à commit" + git push origin develop || echo "Push échoué" + + build-memory-2026: + name: Build Docker image + runs-on: self-hosted + needs: test-memory-2026 + steps: + - uses: actions/checkout@v3 + + - name: Build Docker image + run: | + docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/memory-2026 . + + push-memory-2026: + name: Push Docker image + runs-on: self-hosted + needs: build-memory-2026 + steps: + - name: Login to Docker Hub + run: | + echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin + + - name: Push Docker image + run: | + docker push ${{ secrets.DOCKERHUB_USERNAME }}/memory-2026 + + deploy-memory-2026: + name: Deploy Docker container with Compose + runs-on: self-hosted + needs: push-memory-2026 + steps: + - name: Setup SSH key + run: | + mkdir -p ~/.ssh + echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + + - name: Deploy with docker-compose + run: | + ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} \ + "cd ~/memory && \ + docker-compose pull && \ + docker rm -f memory-2026 || true && \ + docker-compose up -d" + diff --git a/.gitignore b/.gitignore index 496ee2c..2b5e536 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -.DS_Store \ No newline at end of file +.DS_Store +actions-runner/ +*.Zone.Identifier diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b2608be --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM debian:bullseye + +RUN apt-get update \ + && apt-get install -y nginx file \ + && rm -rf /var/lib/apt/lists/* + +RUN apt-get update \ + && apt-get install -y nginx file \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /var/concentration/html + +COPY html/ /var/concentration/html/ + +COPY conf/nginx.conf /etc/nginx/nginx.conf + +EXPOSE 80 + +CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..88d7e78 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '3.8' + +services: + memory-2026: + image: antoine3545/memory-2026:latest + container_name: memory-2026 + ports: + - "8080:80" + restart: unless-stopped diff --git a/html/data/0.jpg b/html/data/0.jpg index 0e259d4..0e73171 100755 Binary files a/html/data/0.jpg and b/html/data/0.jpg differ diff --git a/html/data/11.jpg b/html/data/11.jpg index 0e259d4..0e73171 100755 Binary files a/html/data/11.jpg and b/html/data/11.jpg differ diff --git a/html/data/15.jpg b/html/data/15.jpg index 0e259d4..0e73171 100755 Binary files a/html/data/15.jpg and b/html/data/15.jpg differ diff --git a/html/data/28.jpg b/html/data/28.jpg index 545b203..0e73171 100755 Binary files a/html/data/28.jpg and b/html/data/28.jpg differ diff --git a/html/replacement.jpg b/html/replacement.jpg new file mode 100644 index 0000000..0e73171 Binary files /dev/null and b/html/replacement.jpg differ