First import

This commit is contained in:
root 2020-04-17 10:36:53 -04:00
commit 849da8c135
3 changed files with 67 additions and 0 deletions

5
Dockerfile Normal file
View File

@ -0,0 +1,5 @@
ARG VERSION="latest"
FROM "jcabillot/phpapache:${VERSION}"
LABEL maintainer="Julien Cabillot <dockerimages@cabillot.eu>"
COPY "root" "/var/www/html"

38
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,38 @@
pipeline {
environment {
registry = 'https://registry.hub.docker.com'
registryCredential = 'dockerhub_jcabillot'
dockerImage = 'jcabillot/tracks'
}
agent any
triggers {
cron('@midnight')
}
stages {
stage('Clone repository') {
steps{
checkout scm
}
}
stage('Build image') {
steps{
sh 'docker build --force-rm=true --no-cache=true --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}'
}
}
}
}
}
}

24
root/index.php Normal file
View File

@ -0,0 +1,24 @@
<?php
# Obtain the JSON payload from an OwnTracks app POSTed via HTTP
# and insert into database table.
header("Content-type: application/json");
$payload = file_get_contents("php://input");
$data = @json_decode($payload, true);
if ($data['_type'] == 'location') {
file_put_contents('toto', serialize($data));
$tst = $data['tst'];
$lat = $data['lat'];
$lon = $data['lon'];
$tid = $data['tid'];
# Convert timestamp to a format suitable for mysql
$dt = date('Y-m-d H:i:s', $tst);
}
$response = array();
# optionally add objects to return to the app (e.g.
# friends or cards)
print json_encode($response);
?>