81
packages/docker/shlink/default.nix
Normal file
81
packages/docker/shlink/default.nix
Normal file
@@ -0,0 +1,81 @@
|
||||
{
|
||||
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" ];
|
||||
WorkingDir = "/var/www/shlink";
|
||||
Volumes = {
|
||||
"/var/www/shlink/data" = { };
|
||||
};
|
||||
ExposedPorts = {
|
||||
"8080/tcp" = { };
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user