Skip to content

Commit fffb701

Browse files
committed
add Dockerfile
1 parent e00b59f commit fffb701

File tree

3 files changed

+496
-813
lines changed

3 files changed

+496
-813
lines changed

Dockerfile

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
################### Web Server
2+
# hadolint ignore=DL3007
3+
FROM metacpan/metacpan-base:latest AS server
4+
SHELL [ "/bin/bash", "-euo", "pipefail", "-c" ]
5+
6+
WORKDIR /metacpan-api-v0-shim/
7+
8+
COPY cpanfile cpanfile.snapshot ./
9+
RUN \
10+
--mount=type=cache,target=/root/.perl-cpm,sharing=private \
11+
<<EOT /bin/bash -euo pipefail
12+
cpm install --show-build-log-on-failure
13+
EOT
14+
15+
ENV PERL5LIB="/metacpan-api-v0-shim/local/lib/perl5"
16+
ENV PATH="/metacpan-api-v0-shim/local/bin:${PATH}"
17+
18+
COPY app.psgi ./
19+
COPY lib lib
20+
21+
STOPSIGNAL SIGKILL
22+
23+
CMD [ \
24+
"/uwsgi.sh", \
25+
"--http-socket", ":5001" \
26+
]
27+
28+
EXPOSE 5001
29+
30+
################### Test Runner
31+
FROM server AS test
32+
SHELL [ "/bin/bash", "-euo", "pipefail", "-c" ]
33+
34+
ENV PLACK_ENV=
35+
36+
USER root
37+
38+
RUN \
39+
--mount=type=cache,target=/root/.perl-cpm \
40+
<<EOT /bin/bash -euo pipefail
41+
cpm install --show-build-log-on-failure --with-test
42+
EOT
43+
44+
COPY t t
45+
46+
USER metacpan
47+
CMD [ "prove", "-l", "-r", "-j", "2", "t" ]
48+
49+
################### Production Server
50+
FROM server AS production
51+
52+
USER metacpan

cpanfile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
requires 'Gazelle';
1+
requires 'Cpanel::JSON::XS';
22
requires 'JSON::MaybeXS';
33
requires 'Plack::Builder';
44
requires 'Plack::Request';
55
requires 'HTTP::Tiny';
66
requires 'CPAN::DistnameInfo';
77
requires 'URI::Escape';
8-
requires 'Starman';
98
requires 'Moo';
109
requires 'IO::Socket::SSL' => '1.42';
1110
requires 'Plack::Middleware::SimpleLogger';
1211
requires 'WWW::Form::UrlEncoded';
1312
requires 'HTTP::Request::Common';
14-
requires 'Plack::Test';
15-
requires 'LWP::Protocol::PSGI' => '0.10';
13+
14+
on test => sub {
15+
requires 'Plack::Test';
16+
requires 'LWP::Protocol::PSGI' => '0.10';
17+
};

0 commit comments

Comments
 (0)