Skip to content

Commit

Permalink
Use /var/tmp for tmpdir in docker
Browse files Browse the repository at this point in the history
When run from a docker container the
local var directory is read only, we
should not use it when run from docker.
  • Loading branch information
atoomic committed Dec 7, 2019
1 parent 3364665 commit 381e23c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app.psgi
Expand Up @@ -50,7 +50,8 @@ BEGIN {
use lib "$root_dir/lib";
use MetaCPAN::Web;

my $tempdir = "$root_dir/var/tmp";
# do not use the read only mount point when running from a docker container
my $tempdir = is_linux_container() ? "/var/tmp" : "$root_dir/var/tmp";

STDERR->autoflush;

Expand Down Expand Up @@ -173,3 +174,8 @@ builder {
MetaCPAN::Web->psgi_app;
};
};

sub is_linux_container {
return -e '/proc/1/cgroup';
}

0 comments on commit 381e23c

Please sign in to comment.