-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathDockerfile
More file actions
92 lines (76 loc) · 3.09 KB
/
Dockerfile
File metadata and controls
92 lines (76 loc) · 3.09 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
ARG BASE=node
ARG BASE_VERSION=20.12.0-alpine3.19
FROM ${BASE}:${BASE_VERSION} AS sqitch-build
LABEL org.opencontainers.image.source="https://github.com/launchql/launchql"
# Install system dependencies.
WORKDIR /work
ARG VERSION=1.1.0
RUN mkdir -p /usr/share/man/man1 /usr/share/man/man7 \
&& apk add --no-cache --virtual .build-deps \
alpine-sdk \
perl-dev \
curl \
postgresql-dev \
perl-dbd-pg \
tzdata \
gnupg \
&& apk add --no-cache perl \
&& curl -LO https://www.cpan.org/authors/id/D/DW/DWHEELER/App-Sqitch-v$VERSION.tar.gz \
&& mkdir src \
&& tar -zxf App-Sqitch-v$VERSION.tar.gz --strip-components 1 -C src
# Install cpan and build dependencies.
ENV PERL5LIB /work/local/lib/perl5
RUN curl -sL --compressed https://git.io/cpm > cpm && chmod +x cpm \
&& ./cpm install -L local --verbose --no-test ExtUtils::MakeMaker \
&& ./cpm install -L local --verbose --no-test --with-recommends \
--with-configure --cpanfile src/dist/cpanfile
ENV TZ UTC
RUN cp /usr/share/zoneinfo/UTC /etc/localtime && \
echo UTC > /etc/timezone
# Build, test, bundle, prune.
WORKDIR /work/src
RUN perl Build.PL --quiet --install_base /app --etcdir /etc/sqitch \
--config installman1dir= --config installsiteman1dir= --config installman3dir= --config installsiteman3dir= \
--with postgres \
&& ln -s /usr/include/ibase.h \
# && ./Build test
&& ./Build bundle \
&& rm -rf /app/man \
&& find /app -name '*.pod' | grep -v sqitch | xargs rm -rf
RUN apk del .build-deps
################################################################################
# Copy to the final image without all the build stuff.
ARG BASE=node
ARG BASE_VERSION=20.12.0-alpine3.19
FROM ${BASE}:${BASE_VERSION} AS sqitch
LABEL org.opencontainers.image.source="https://github.com/launchql/launchql"
# Install runtime system dependencies and remove unnecesary files.
RUN mkdir -p /usr/share/man/man1 /usr/share/man/man7 \
&& apk add --no-cache --virtual .build-deps2 \
# perl \
ca-certificates \
# libpq5 \
# postgresql-client \
&& apk add --no-cache \
perl \
postgresql-client \
# ca-certificates \
# libpq5 \
&& mkdir -p /etc/pki/tls && ln -s /etc/ssl/certs /etc/pki/tls/ \
&& rm -rf /var/cache/apt/* /var/lib/apt/lists/* /usr/bin/mysql?* \
&& rm -rf /plibs /man /usr/share/man /usr/share/doc /usr/share/postgresql \
/usr/share/nano /etc/nanorc \
&& find / -name '*.pod' | grep -v sqitch | xargs rm -rf \
&& find / -name '*.ph' -delete \
&& find / -name '*.h' -delete
# Copy the app and config from the build image.
COPY --from=sqitch-build /app .
COPY --from=sqitch-build /etc/sqitch /etc/sqitch/
COPY --from=sqitch-build /etc/localtime /etc/localtime
COPY --from=sqitch-build /etc/timezone /etc/timezone
RUN apk del .build-deps2
# Set up environment, entrypoint, and default command.
ENV LESS=-R LC_ALL=C.UTF-8 LANG=C.UTF-8 SQITCH_EDITOR=vi SQITCH_PAGER=less
# for gyp and such
RUN apk update && apk add --no-cache bash git python3-dev make g++
ENTRYPOINT ["/bin/sh"]