forked from GeertJohan/docker-pgmodeler-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
94 lines (71 loc) · 2.07 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
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
93
94
# syntax = docker/dockerfile:1.4
FROM --platform=$BUILDPLATFORM ubuntu:noble-20241011 as base
ENV DEBIAN_FRONTEND=noninteractive
RUN <<EOT sh -ex
apt-get update
apt-get upgrade -y
apt-get install -y --no-install-recommends \
libpq5 \
libqt6network6 \
libqt6printsupport6 \
libqt6svg6 \
libqt6widgets6 \
qt6-qpa-plugins
EOT
FROM base as builder
ARG PGM_VERSION
ENV PGM_VERSION=$PGM_VERSION
ENV QT_SELECT=qt6
WORKDIR "/usr/local/src/pgmodeler"
RUN <<EOT sh -ex
apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
libgl-dev \
libpq-dev \
libqt6svg6-dev \
libxext-dev \
libxml2-dev \
pkg-config \
qt6-base-dev \
curl
EOT
RUN <<EOT sh -ex
curl -f -o "v${PGM_VERSION}.tar.gz" -LO "https://github.com/pgmodeler/pgmodeler/archive/v${PGM_VERSION}.tar.gz"
tar -xzf "v${PGM_VERSION}.tar.gz"
EOT
WORKDIR "/usr/local/src/pgmodeler/pgmodeler-${PGM_VERSION}"
RUN <<EOT sh -ex
rm -f .qmake.stash
qmake6 -r CONFIG+=release pgmodeler.pro
make -j "$(nproc)"
make install
strip /usr/local/bin/pgmodeler-cli
strip /usr/local/lib/pgmodeler/*
EOT
RUN <<EOT sh -ex
mkdir -p /tmp/local/bin
mkdir -p /tmp/local/lib
mkdir -p /tmp/local/share
cp -pR /usr/local/bin/pgmodeler-cli /tmp/local/bin
cp -pR /usr/local/lib/pgmodeler /tmp/local/lib
cp -pR /usr/local/share/pgmodeler /tmp/local/share
EOT
FROM base
COPY --link --from=builder /tmp/local/ /usr/local/
ENV QT_QPA_PLATFORM=offscreen
ENV XDG_RUNTIME_DIR=/tmp/runtime-root
RUN <<EOT sh -ex
mkdir -p /root/.config
ln -s /usr/local/share/pgmodeler/conf /root/.config/pgmodeler-1.0
apt-get install -y fonts-noto-cjk --no-install-recommends
apt-get clean
apt-get autoremove -y
rm -rf /var/lib/apt/lists/*
rm -rf /tmp/*
mkdir -p /tmp/runtime-root
chmod 0700 /tmp/runtime-root
EOT
WORKDIR /data
ENTRYPOINT ["/usr/local/bin/pgmodeler-cli"]
CMD []