-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.uos
More file actions
264 lines (230 loc) · 8.3 KB
/
Copy pathDockerfile.uos
File metadata and controls
264 lines (230 loc) · 8.3 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#FROM rust:slim
#FROM uosproject/uos
#FROM registry.uniontech.com/uos-app/uos-server-20-1070a-rust:1.58.1-amd64
#FROM ahu37/uos-toolchain
#FROM ubuntu:20.04
#FROM alpine:3.22
#FROM rust:alpine
#FROM alpine:edge
FROM macrosan/uos:v20-1070
#FROM ubuntu:25.04
# Install required dependencies
# Alpine
# apk ==> yum; apk add ==> yum install -y
# RUN apk update && apk add \
# musl-dev \
# openssl-dev \
# pkgconf \
#
# RUN apk add --no-cache \
# cargo \
# rustup \
# gtk+3.0-dev \
# # gtk+3.0-static \
# glib-dev \
# glib-static \
# cairo-dev \
# cairo-static \
# pango-dev \
# # pango-static \
# # atk-dev \
# # atk-static \
# # gdk-pixbuf-dev \
# # gdk-pixbuf-static \
# harfbuzz-dev \
# harfbuzz-static \
# zlib-dev \
# zlib-static \
# # libappindicator-dev \
# librsvg-dev
# # webkit2gtk-dev
# RUN apk update && apk add curl
# RUN apk update && apk add ca-certificates
# # Install latest Rust with PATH properly set for the current shell
# # RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
# # && . $HOME/.cargo/env \
# # && cargo -V
# # ENV PATH="/root/.cargo/bin:${PATH}"
# #RUN sed -i 's|http://archive.ubuntu.com/ubuntu|http://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list && apt update
# RUN DEBIAN_FRONTEND=noninteractive apk add tzdata
# RUN DEBIAN_FRONTEND=noninteractive TZ=Asia/Shanghai apk update && apk add gtk+3.0-dev
# #RUN apk update && apk add libappindicator-dev
# RUN apk update && apk add librsvg-dev
# #RUN apk update && apk add webkit2gtk-dev
# RUN apk update && apk add glib-dev sqlite-dev
# # RUN apk update && apk add librust-atk-sys-dev
# # RUN apk update && apk add musl-tools
# RUN apk update && apk add wget perl build-base musl-dev make
# RUN apk update && apk add linux-headers
# RUN apk update && apk add libc-dev
# Ubuntu
# Install required dependencies
#RUN sed -i 's|http://archive.ubuntu.com/ubuntu|http://mirrors.aliyun.com/ubuntu|g' /etc/apt/sources.list && apt update
RUN yum -y update
RUN yum update && yum install gtk3
RUN yum update && yum install -y curl
RUN yum update && yum install -y ca-certificates
RUN DEBIAN_FRONTEND=noninteractive yum update && yum install -y tzdata
RUN DEBIAN_FRONTEND=noninteractive TZ=Asia/Shanghai yum update && yum install -y gtk3
RUN yum update && yum install -y libappindicator-gtk3
RUN yum update && yum install -y librsvg2
# RUN yum update && yum install -y webkit2gtk
RUN yum update && yum install -y glib
# RUN yum update && yum install -y rust
RUN yum update && yum install -y bison unzip zip musl-gcc wget git
# RUN wget https://www.openssl.org/source/openssl-1.1.1w.tar.gz && \
# tar xzf openssl-1.1.1w.tar.gz && \
# cd openssl-1.1.1w && \
# # 指定正确的目标平台为 linux-x86_64
# # 禁用安全内存功能(解决缺少linux/mman.h的问题)
# CC="gcc -fPIE -pie" ./Configure \
# no-shared \
# no-zlib \
# no-async \
# no-engine \
# no-secure-memory \
# -fPIC \
# --prefix=/usr/local/musl \
# linux-x86_64 && \
# make depend && \
# make -j$(nproc) && \
# make install && \
# cd .. && \
# rm -rf openssl-1.1.1w*
# Install latest Rust with PATH properly set for the current shell
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \
&& . $HOME/.cargo/env \
&& cargo -V
#ENV PATH="/root/.cargo/bin:${PATH}"
RUN yum update && yum install -y \
openssl-devel \
python3 \
gtk3-devel \
gdk-pixbuf2-devel \
harfbuzz-devel \
atk-devel \
cairo-devel \
glib2-devel \
pango-devel \
pkg-config \
&& yum groupinstall -y "Development Tools"
RUN yum install -y clang
RUN wget https://www.openssl.org/source/openssl-3.0.9.tar.gz && \
tar xzf openssl-3.0.9.tar.gz && \
cd openssl-3.0.9 && \
CC="gcc" ./Configure \
--prefix=/usr/local/musl \
--libdir=lib \
no-shared \
no-zlib \
no-async \
linux-x86_64 && \
make -j$(nproc) && \
make install && \
cd .. && \
rm -rf openssl-3.0.9*
# Initialize rustup and install the default toolchain
# RUN rustup-init -y --default-toolchain stable
ENV PATH="/root/.cargo/bin:${PATH}"
RUN wget https://download.gnome.org/sources/gtk+/3.24/gtk+-3.24.0.tar.xz && \
tar xf gtk+-3.24.0.tar.xz && \
cd gtk+-3.24.0 && \
./configure --enable-static \
--enable-all \
--with-included-immodules && \
make && \
make install
# 静态编译 Cairo
RUN wget https://www.cairographics.org/releases/cairo-1.16.0.tar.xz && \
tar xf cairo-1.16.0.tar.xz && \
cd cairo-1.16.0 && \
./configure --enable-static --enable-all && \
make && \
make install
RUN pip3 install meson==0.60.0 && \
pip3 install ninja && \
echo 'export PATH=$PATH:~/.local/bin' >> ~/.bashrc && \
source ~/.bashrc
RUN wget https://download.gnome.org/sources/pango/1.50/pango-1.50.14.tar.xz && \
tar xf pango-1.50.14.tar.xz && \
cd pango-1.50.14 && \
meson setup build \
--default-library=static \
-Dintrospection=disabled \
-Dgtk_doc=false \
-Dinstall-tests=false \
--prefix=/usr/local && \
ninja -C build && \
ninja -C build install
RUN wget https://github.com/harfbuzz/harfbuzz/releases/download/2.9.1/harfbuzz-2.9.1.tar.xz && \
tar xf harfbuzz-2.9.1.tar.xz && \
cd harfbuzz-2.9.1 && \
./configure --enable-static --enable-all && \
make && \
make install
RUN yum install -y ninja-build && \
wget https://download.gnome.org/sources/atk/2.38/atk-2.38.0.tar.xz && \
tar xf atk-2.38.0.tar.xz && \
cd atk-2.38.0 && \
meson setup build-static \
--default-library=static \
-Dintrospection=false && \
ninja -C build-static && \
ninja -C build-static install
RUN wget https://download.gnome.org/sources/gdk-pixbuf/2.42/gdk-pixbuf-2.42.10.tar.xz && \
tar xf gdk-pixbuf-2.42.10.tar.xz && \
cd gdk-pixbuf-2.42.10 && \
meson setup build-static \
--default-library=static \
-Dbuiltin_loaders=all \
-Ddocs=false \
-Dman=false \
-Dinstalled_tests=false && \
ninja -C build-static && \
ninja -C build-static install
RUN ldd --version
# Build the application
RUN rustup target add x86_64-unknown-linux-musl x86_64-unknown-linux-gnu
# RUSTFLAGS="-C target-feature=+crt-static"
WORKDIR /app1
RUN ldd --version
#RUN cargo clean
COPY . .
COPY docs/astgrep-Guide.md ./docs/
RUN cargo clean
# PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_STATIC=1 PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib/x86_64-alpine-linux-musl/pkgconfig GLIB_STATIC=1 OPENSSL_STATIC=1 OPENSSL_DIR=/usr/local/musl RUSTFLAGS="-C target-feature=+crt-static" cargo build --release --target x86_64-unknown-linux-gnu
RUN PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_STATIC=1 \
PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib/x86_64-alpine-linux-musl/pkgconfig \
#GLIB_STATIC=1 \
OPENSSL_STATIC=1 \
OPENSSL_DIR=/usr/local/musl \
#RUSTFLAGS="-C target-feature=+crt-static" \
cargo build --release --target x86_64-unknown-linux-gnu -p astgrep
RUN PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_STATIC=1 \
PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib/x86_64-alpine-linux-musl/pkgconfig \
#GLIB_STATIC=1 \
OPENSSL_STATIC=1 \
OPENSSL_DIR=/usr/local/musl \
#RUSTFLAGS="-C target-feature=+crt-static" \
cargo build --release --target x86_64-unknown-linux-gnu -p astgrep-cli
RUN PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_STATIC=1 \
PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib/x86_64-alpine-linux-musl/pkgconfig \
#GLIB_STATIC=1 \
OPENSSL_STATIC=1 \
OPENSSL_DIR=/usr/local/musl \
#RUSTFLAGS="-C target-feature=+crt-static" \
cargo build --release --target x86_64-unknown-linux-gnu -p astgrep-web
RUN PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_STATIC=1 \
PKG_CONFIG_PATH=/usr/lib/pkgconfig:/usr/lib/x86_64-alpine-linux-musl/pkgconfig \
#GLIB_STATIC=1 \
OPENSSL_STATIC=1 \
OPENSSL_DIR=/usr/local/musl \
#RUSTFLAGS="-C target-feature=+crt-static" \
cargo build --release --target x86_64-unknown-linux-gnu -p astgrep-gui
# Create the output directory
RUN mkdir -p /output
RUN cp target/x86_64-unknown-linux-gnu/release/astgrep /output/
RUN cp target/x86_64-unknown-linux-gnu/release/astgrep-cli /output/
RUN cp target/x86_64-unknown-linux-gnu/release/astgrep-web /output/
RUN cp target/x86_64-unknown-linux-gnu/release/astgrep-web-server /output/
RUN cp target/x86_64-unknown-linux-gnu/release/astgrep-gui /output/