Compare commits
1 Commits
master
..
dab093e325
| Author | SHA1 | Date | |
|---|---|---|---|
| dab093e325 |
@@ -1,33 +1,25 @@
|
|||||||
name: Cron - Docker Build & Push
|
name: Docker Build and Push
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 0 * * *'
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
hadolint:
|
build:
|
||||||
runs-on: ubuntu-latest
|
|
||||||
continue-on-error: true
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
||||||
|
|
||||||
- name: Hadolint Dockerfile
|
|
||||||
continue-on-error: true
|
|
||||||
run: docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace hadolint/hadolint:v2.12.0 hadolint Dockerfile
|
|
||||||
|
|
||||||
build-push:
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
|
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4
|
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
@@ -39,14 +31,16 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
images: jcabillot/huawei-3g-sms-api
|
images: jcabillot/huawei-3g-sms-api
|
||||||
tags: |
|
tags: |
|
||||||
type=raw,value=latest,enable=true
|
#type=ref,event=branch
|
||||||
type=sha
|
#type=ref,event=pr
|
||||||
|
#type=sha
|
||||||
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
|
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
pull: true
|
pull: true
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
name: Main - Docker Build, Push & Tag
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [master]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
hadolint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
continue-on-error: true
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
||||||
|
|
||||||
- name: Hadolint Dockerfile
|
|
||||||
continue-on-error: true
|
|
||||||
run: docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace hadolint/hadolint:v2.12.0 hadolint Dockerfile
|
|
||||||
|
|
||||||
build-push:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Docker metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6
|
|
||||||
with:
|
|
||||||
images: jcabillot/huawei-3g-sms-api
|
|
||||||
tags: |
|
|
||||||
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' }}
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
pull: true
|
|
||||||
|
|
||||||
tag:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [build-push]
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Bump version and push tag
|
|
||||||
uses: anothrNick/github-tag-action@4ed44965e0db8dab2b466a16da04aec3cc312fd8 # v1.75.0
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
DEFAULT_BUMP: patch
|
|
||||||
RELEASE_BRANCHES: master
|
|
||||||
WITH_V: true
|
|
||||||
GIT_API_TAGGING: false
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
name: PR - Docker Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches: [master]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
hadolint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
continue-on-error: true
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
||||||
|
|
||||||
- name: Hadolint Dockerfile
|
|
||||||
continue-on-error: true
|
|
||||||
run: docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace hadolint/hadolint:v2.12.0 hadolint Dockerfile
|
|
||||||
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: false
|
|
||||||
tags: jcabillot/huawei-3g-sms-api:${{ github.sha }}
|
|
||||||
pull: true
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
name: Tag - Docker Build & Push
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
hadolint:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
continue-on-error: true
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
||||||
|
|
||||||
- name: Hadolint Dockerfile
|
|
||||||
continue-on-error: true
|
|
||||||
run: docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace hadolint/hadolint:v2.12.0 hadolint Dockerfile
|
|
||||||
|
|
||||||
build-push:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Docker metadata
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6
|
|
||||||
with:
|
|
||||||
images: jcabillot/huawei-3g-sms-api
|
|
||||||
tags: |
|
|
||||||
type=ref,event=tag
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
pull: true
|
|
||||||
+4
-4
@@ -1,12 +1,12 @@
|
|||||||
# syntax=docker.io/docker/dockerfile:1
|
# syntax=docker.io/docker/dockerfile:1@sha256:87999aa3d42bdc6bea60565083ee17e86d1f3339802f543c0d03998580f9cb89
|
||||||
|
|
||||||
FROM python:3.14-alpine AS pipdependencies
|
FROM "python:3.11-alpine" AS pipdependencies
|
||||||
|
|
||||||
COPY app/requirements.txt /requirements.txt
|
COPY app/requirements.txt /requirements.txt
|
||||||
|
|
||||||
RUN pip3 install --no-cache-dir --user --requirement requirements.txt
|
RUN pip3 install --no-cache-dir --user --requirement requirements.txt
|
||||||
|
|
||||||
FROM python:3.14-alpine
|
FROM "python:3.11-alpine"
|
||||||
LABEL maintainer="Cabillot Julien <dockerimages@cabillot.eu>"
|
LABEL maintainer="Cabillot Julien <dockerimages@cabillot.eu>"
|
||||||
|
|
||||||
# TODO: à tester
|
# TODO: à tester
|
||||||
@@ -19,7 +19,7 @@ WORKDIR "/app"
|
|||||||
|
|
||||||
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
||||||
|
|
||||||
COPY --from=binwiederhier/ntfy:v2.25.0 /usr/bin/ntfy /usr/local/bin/ntfy
|
COPY --from=binwiederhier/ntfy:v2.24.0@sha256:f8a9b104313b87cc24ae4f775f39e6328205b57dff6ede3eaf098a91e5d79f59 /usr/bin/ntfy /usr/local/bin/ntfy
|
||||||
RUN mkdir /etc/ntfy
|
RUN mkdir /etc/ntfy
|
||||||
|
|
||||||
COPY --from=pipdependencies /root/.local /root/.local
|
COPY --from=pipdependencies /root/.local /root/.local
|
||||||
|
|||||||
Vendored
+38
@@ -0,0 +1,38 @@
|
|||||||
|
pipeline {
|
||||||
|
environment {
|
||||||
|
registry = 'https://registry.hub.docker.com'
|
||||||
|
registryCredential = 'dockerhub_jcabillot'
|
||||||
|
dockerImage = 'jcabillot/huawei-3g-sms-api'
|
||||||
|
}
|
||||||
|
|
||||||
|
agent any
|
||||||
|
|
||||||
|
triggers {
|
||||||
|
cron('@midnight')
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Clone repository') {
|
||||||
|
steps{
|
||||||
|
checkout scm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Build image') {
|
||||||
|
steps{
|
||||||
|
sh 'docker build --force-rm --no-cache --pull -t ${dockerImage} .'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Deploy Image') {
|
||||||
|
steps{
|
||||||
|
script {
|
||||||
|
withCredentials([usernamePassword(credentialsId: 'dockerhub_jcabillot', usernameVariable: 'DOCKER_USER', passwordVariable: 'DOCKER_PASS')]) {
|
||||||
|
sh 'docker login --username ${DOCKER_USER} --password ${DOCKER_PASS}'
|
||||||
|
sh 'docker push ${dockerImage}'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1 +1,2 @@
|
|||||||
xmltodict==1.0.4
|
pushbullet.py==0.11.0
|
||||||
|
xmltodict==0.12.0
|
||||||
|
|||||||
@@ -6,8 +6,13 @@ import xmltodict
|
|||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
|
# TODO: disabled api excess
|
||||||
|
#from pushbullet import Pushbullet
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
# TODO: disabled api excess
|
||||||
|
#pb = Pushbullet(os.environ['PB_APIKEY'])
|
||||||
|
|
||||||
pin = os.environ['PIN']
|
pin = os.environ['PIN']
|
||||||
|
|
||||||
PIN_ENTER_TEMPLATE = '''<request>
|
PIN_ENTER_TEMPLATE = '''<request>
|
||||||
@@ -157,6 +162,10 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
# Text
|
# Text
|
||||||
f3.write(messages[i] + '\n')
|
f3.write(messages[i] + '\n')
|
||||||
|
# Pushbullet
|
||||||
|
print('# Notif pushbullet')
|
||||||
|
# TODO: disabled api excess
|
||||||
|
#pb.push_note("SMS", "From: %s\nDate: %s\n%s" % (messagesR[i]['Phone'], messagesR[i]['Date'], messagesR[i]['Content']))
|
||||||
|
|
||||||
# NTFY
|
# NTFY
|
||||||
# TODO: exec ntfy publish
|
# TODO: exec ntfy publish
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@ version: '2.3'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
image: "jcabillot/huawei-3g-sms-api"
|
image: "jcabillot/huawei-3g-sms-api@sha256:a76358b2ee123d6570b93802e1813e46b9a634065400bae38202c2ded29deb73"
|
||||||
container_name: "huawei-3g-sms-api"
|
container_name: "huawei-3g-sms-api"
|
||||||
restart: "unless-stopped"
|
restart: "unless-stopped"
|
||||||
mem_limit: "256m"
|
mem_limit: "256m"
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
||||||
"customManagers": [
|
|
||||||
{
|
|
||||||
"customType": "regex",
|
|
||||||
"description": "Track ntfy binary in COPY --from",
|
|
||||||
"managerFilePatterns": ["/^Dockerfile$/"],
|
|
||||||
"matchStrings": ["COPY --from=binwiederhier/ntfy:(?<currentValue>[^\\s]+)"],
|
|
||||||
"depNameTemplate": "binwiederhier/ntfy",
|
|
||||||
"datasourceTemplate": "docker"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user