48 lines
1,016 B
Nix
48 lines
1,016 B
Nix
|
{ nixpkgs, flutils, blog-pim, nginx, ... }: flutils.lib.eachDefaultSystem (system:
|
||
|
let
|
||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||
|
nginxPort = "80";
|
||
|
nginxConf = pkgs.writeText "nginx.conf" ''
|
||
|
user nobody nobody;
|
||
|
daemon off;
|
||
|
error_log /dev/stdout info;
|
||
|
pid /dev/null;
|
||
|
events {}
|
||
|
http {
|
||
|
access_log /dev/stdout;
|
||
|
include ${nginx.outPath}/conf/mime.types;
|
||
|
|
||
|
server {
|
||
|
listen ${nginxPort};
|
||
|
index index.html;
|
||
|
location / {
|
||
|
root ${blog-pim.packages.${system}.static-website};
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
'';
|
||
|
in
|
||
|
{
|
||
|
packages.blog-pim = pkgs.dockerTools.buildLayeredImage {
|
||
|
name = "blog-pim";
|
||
|
tag = "test"; # TODO: what is the best way to tag this?
|
||
|
|
||
|
contents = [
|
||
|
pkgs.fakeNss
|
||
|
pkgs.nginx
|
||
|
];
|
||
|
|
||
|
extraCommands = ''
|
||
|
mkdir -p tmp/nginx_client_body
|
||
|
mkdir -p var/log/nginx
|
||
|
'';
|
||
|
|
||
|
config = {
|
||
|
Cmd = [ "nginx" "-c" nginxConf ];
|
||
|
ExposedPorts = {
|
||
|
"${nginxPort}/tcp" = { };
|
||
|
};
|
||
|
};
|
||
|
};
|
||
|
})
|