82 lines
1.3 KiB
Nix
82 lines
1.3 KiB
Nix
{
|
|
pkgs,
|
|
inputs,
|
|
system,
|
|
...
|
|
}:
|
|
let
|
|
selfPkgs = inputs.self.packages.${system};
|
|
|
|
php = pkgs.php84.buildEnv {
|
|
extensions =
|
|
{ all, ... }:
|
|
with all;
|
|
[
|
|
curl
|
|
pdo
|
|
pdo_sqlite
|
|
pdo_pgsql
|
|
intl
|
|
gd
|
|
sockets
|
|
bcmath
|
|
filter
|
|
mbstring
|
|
zlib
|
|
];
|
|
|
|
extraConfig = ''
|
|
expose_php = Off
|
|
'';
|
|
};
|
|
|
|
shlink = pkgs.runCommandLocal "shlink" { } ''
|
|
mkdir -p $out/var/www
|
|
cp -r ${selfPkgs.shlink} $out/var/www/shlink
|
|
'';
|
|
|
|
shlink-cli = pkgs.writeShellApplication {
|
|
name = "shlink";
|
|
text = ''
|
|
exec /var/www/shlink/bin/cli "$@"
|
|
'';
|
|
};
|
|
|
|
entrypoint = pkgs.writeTextFile {
|
|
name = "entrypoint";
|
|
executable = true;
|
|
destination = "/bin/entrypoint";
|
|
text = builtins.readFile ./entrypoint.sh;
|
|
};
|
|
in
|
|
pkgs.dockerTools.buildImage {
|
|
name = "shlink";
|
|
fromImage = import ../base { inherit pkgs; };
|
|
|
|
copyToRoot = pkgs.buildEnv {
|
|
name = "root";
|
|
paths = [
|
|
entrypoint
|
|
shlink
|
|
shlink-cli
|
|
php
|
|
pkgs.roadrunner
|
|
];
|
|
pathsToLink = [
|
|
"/bin"
|
|
"/var"
|
|
];
|
|
};
|
|
|
|
config = {
|
|
Entrypoint = [ "entrypoint" ];
|
|
ExposedPorts = {
|
|
"8080/tcp" = { };
|
|
};
|
|
WorkingDir = "/var/www/shlink";
|
|
Volumes = {
|
|
"/var/www/shlink/data" = { };
|
|
};
|
|
};
|
|
}
|