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