31 lines
839 B
Nix
31 lines
839 B
Nix
{ pkgs ? import <nixpkgs> {} }:
|
|
|
|
let utils = import ../deployment/utils.nix {} ;
|
|
files = [
|
|
(utils.copy ./cgiup.rb "home/joske/cgiup.rb")
|
|
(utils.copy ./ruby_challenge.rb "home/joske/ruby_challenge.rb")
|
|
] ;
|
|
in
|
|
pkgs.dockerTools.buildImage {
|
|
name = "ruby-challenge";
|
|
tag = "latest";
|
|
contents = files ++ [ pkgs.ruby pkgs.coreutils pkgs.busybox ];
|
|
runAsRoot = ''
|
|
${pkgs.dockerTools.shadowSetup}
|
|
useradd -U -m joske
|
|
mkdir -p /home/joske
|
|
mkdir /tmp
|
|
chmod o+rw /tmp
|
|
chmod +x /home/joske/ruby_challenge.rb
|
|
chown -R joske:joske /home/joske
|
|
chmod -R -w /home/joske
|
|
'';
|
|
config = {
|
|
ExposedPorts = {
|
|
"3000/tcp" = {};
|
|
};
|
|
WorkingDir = "/home/joske/";
|
|
Cmd = [ "${pkgs.ruby}/bin/ruby" "cgiup.rb" "ruby_challenge.rb" ];
|
|
};
|
|
}
|