Initial commit
Signed-off-by: Louis Vallat <louis@louis-vallat.xyz>
This commit is contained in:
commit
921c23aa80
31
.gitlab-ci.yml
Normal file
31
.gitlab-ci.yml
Normal file
@ -0,0 +1,31 @@
|
||||
image: docker:latest
|
||||
services:
|
||||
- docker:dind
|
||||
|
||||
stages:
|
||||
- release
|
||||
- deploy
|
||||
|
||||
variables:
|
||||
# Use TLS https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#tls-enabled
|
||||
DOCKER_HOST: tcp://docker:2376
|
||||
DOCKER_TLS_CERTDIR: "/certs"
|
||||
CONTAINER_BRANCH_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
||||
CONTAINER_RELEASE_IMAGE: $CI_REGISTRY_IMAGE:latest
|
||||
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
|
||||
- docker build . -t $CONTAINER_BRANCH_IMAGE
|
||||
- docker push $CONTAINER_BRANCH_IMAGE
|
||||
|
||||
deploy:
|
||||
stage: deploy
|
||||
before_script:
|
||||
- eval $(ssh-agent -s)
|
||||
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
|
||||
- mkdir -p ~/.ssh
|
||||
- chmod 700 ~/.ssh
|
||||
script:
|
||||
- ssh -o StrictHostKeyChecking=no -p $SSH_PORT $SSH_DESTINATION "cd $PATH_TO_APPLICATION; $UPGRADE_COMMAND;"
|
5
Dockerfile
Normal file
5
Dockerfile
Normal file
@ -0,0 +1,5 @@
|
||||
FROM php:apache
|
||||
EXPOSE 80
|
||||
COPY src/ /var/www/html/
|
||||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" && \
|
||||
docker-php-ext-install -j$(nproc) opcache
|
14
src/subtitles.php
Normal file
14
src/subtitles.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
$ch = curl_init();
|
||||
// IMPORTANT: the below line is a security risk, read https://paragonie.com/blog/2017/10/certainty-automated-cacert-pem-management-for-php-software
|
||||
// in most cases, you should set it to true
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://api.moviequotebot.louis-vallat.xyz/v1/subtitles/list');
|
||||
$result = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$obj = json_decode($result, true);
|
||||
foreach ($obj["films"] as $film) {
|
||||
echo $film["title"] . "<br>\n";
|
||||
}
|
Loading…
Reference in New Issue
Block a user