initial commit
All checks were successful
continuous-integration/woodpecker the build was successful

This commit is contained in:
Samuel Philipp 2021-12-25 22:24:23 +01:00
commit 404138abaf
6 changed files with 90 additions and 0 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
.idea/
*.iml

30
.woodpecker.yml Normal file
View file

@ -0,0 +1,30 @@
pipeline:
docker:
image: plugins/docker
secrets:
- DOCKER_USERNAME
- DOCKER_PASSWORD
repo: spcodes/pixelfed
tags:
- latest
when:
branch:
- main
event:
- push
cr:
image: plugins/docker
secrets:
- source: CR_USERNAME
target: DOCKER_USERNAME
- source: CR_PASSWORD
target: DOCKER_PASSWORD
registry: cr.sp-codes.de
repo: cr.sp-codes.de/pixelfed
tags:
- latest
when:
branch:
- main
event:
- push

5
Dockerfile Normal file
View file

@ -0,0 +1,5 @@
FROM zknt/pixelfed@sha256:91a991c830e652e43f756278af0b06f0e3e6eedf1a2c522ed7ceb9b1ac7552bc
COPY wait-for-db.php /wait-for-db.php
RUN apt-install php${PHPVER}-pgsql

7
README.md Normal file
View file

@ -0,0 +1,7 @@
# [Pixelfed](https://git.sp-codes.de/sp-codes/pixelfed)
[![Build Status](https://ci.sp-codes.de/api/badges/sp-codes/pixelfed/status.svg)](https://ci.sp-codes.de/sp-codes/pixelfed) [![Docker Pulls](https://img.shields.io/docker/pulls/spcodes/pixelfed)](https://hub.docker.com/r/spcodes/pixelfed)
## Usage
tbd

10
renovate.json Normal file
View file

@ -0,0 +1,10 @@
{
"assignees": [
"samuel-p"
],
"baseBranches": [
"main"
],
"rangeStrategy": "bump",
"rebaseWhen": "behind-base-branch"
}

36
wait-for-db.php Normal file
View file

@ -0,0 +1,36 @@
<?php
function connect()
{
$connection = getenv('DB_CONNECTION');
$host = getenv('DB_HOST');
$username = getenv('DB_USERNAME');
$password = getenv('DB_PASSWORD');
$database = getenv('DB_DATABASE');
$port = getenv('DB_PORT');
if ($connection === 'mysql') {
return mysqli_connect($host, $username, $password, $database, $port);
}
if ($connection === 'pgsql') {
return pg_connect('host=' . $host . ' port=' . $port . ' dbname=' . $database . ' user=' . $username . ' password=' . $password);
}
throw new Exception('unsupported connection type ' . $connection);
}
$conn = connect();
$counter = 10;
$count = 1;
while (!$conn) {
echo("Waiting for Database... $count / $counter\n");
sleep(2);
$conn = connect();
$count++;
if ($count == $counter) {
echo("Database did not respond after $counter tries, giving up\n");
die(1);
}
}
echo "Database is up\n";
?>