Skip to content

Commit 5044f96

Browse files
authored
Merge pull request #897 from metacpan/ssoriche/add_docker_base_image
Add docker base image use
2 parents 544d11e + 174be27 commit 5044f96

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PGDB=db:5432
2+
API_SERVER=morbo -l http://*:5000 -w /metacpan-api --verbose

Dockerfile

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
FROM perl:5.22
1+
FROM metacpan/metacpan-base:latest
22

33
ENV PERL_MM_USE_DEFAULT=1 PERL_CARTON_PATH=/carton
44

5-
COPY wait-for-it.sh /
65
COPY cpanfile cpanfile.snapshot /metacpan-api/
76
WORKDIR /metacpan-api
87

9-
RUN apt-get update \
10-
&& apt-get install -y libgmp-dev rsync \
11-
&& cpanm App::cpm \
12-
&& cpm install -g Carton \
13-
&& useradd -m metacpan-api -g users \
8+
# CPM installations of dependencies does not install or run tests. This is
9+
# because the modules themselves have been tested, and the metacpan use of the
10+
# modules is tested by the test suite. Removing the tests, reduces the overall
11+
# size of the images.
12+
RUN useradd -m metacpan-api -g users \
1413
&& mkdir /carton /CPAN \
15-
&& cpm install -L /carton \
14+
&& cpm install --without-test -L /carton \
1615
&& rm -fr /root/.cpanm /root/.perl-cpm /var/cache/apt/lists/* /tmp/*
1716

1817
RUN chown -R metacpan-api:users /metacpan-api /carton /CPAN
@@ -25,4 +24,4 @@ USER metacpan-api:users
2524

2625
EXPOSE 5000
2726

28-
CMD [ "/wait-for-it.sh", "db:5432", "--", "carton", "exec", "morbo", "-l", "http://*:5000", "-w", "root", "./bin/api.pl"]
27+
CMD /wait-for-it.sh ${PGDB} -- carton exec ${API_SERVER} ./bin/api.pl

cpanfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ requires 'CatalystX::Component::Traits';
3030
requires 'CatalystX::Fastly::Role::Response', '0.06';
3131
requires 'CatalystX::InjectComponent';
3232
requires 'CatalystX::RoleApplicator';
33+
requires 'Config::General';
3334
requires 'Config::ZOMG', '>=', '1.000000';
3435
requires 'Const::Fast';
3536
requires 'Cpanel::JSON::XS', '3.0115';
@@ -193,7 +194,6 @@ test_requires 'App::Prove';
193194
test_requires 'CPAN::Faker', '0.010';
194195
test_requires 'Code::TidyAll', '>= 0.47';
195196
test_requires 'Code::TidyAll::Plugin::UniqueLines';
196-
test_requires 'Config::General';
197197
test_requires 'Devel::Confess';
198198
test_requires 'File::Copy';
199199
test_requires 'HTTP::Cookies';

0 commit comments

Comments
 (0)