-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
138 lines (109 loc) · 4.33 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
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
# pull alpine build container
FROM arm64v8/node:alpine3.21 as build
# Install deps
RUN apk add --no-cache \
build-base \
python3 \
libpng-dev \
ca-certificates \
git \
fuse \
fuse-dev \
jq
# Pull XO from master
RUN git clone -b master https://github.com/vatesfr/xen-orchestra /etc/xen-orchestra && \
git clone https://github.com/sagemathinc/fuse-native /etc/fuse-native && \
git clone https://github.com/fuse-friends/fuse-shared-library-linux-arm /etc/fuse-shared-library-linux
RUN cd /etc/fuse-native && \
jq '.name = "fuse-native"' package.json | \
jq '.dependencies["napi-macros"] = "^2.2.2"' > package.temp.json && \
mv package.temp.json package.json && \
yarn install --update-checksums --no-lockfile && \
yarn link
RUN cd /etc/fuse-shared-library-linux && \
jq '.name = "fuse-shared-library-linux"' package.json > package.temp.json && \
mv package.temp.json package.json && \
yarn link
RUN cd /etc/xen-orchestra && \
jq '.devDependencies["fuse-native"] = "file:/etc/fuse-native"' package.json | \
jq '.devDependencies["napi-macros"] = "^2.2.2"' package.json | \
jq '.devDependencies["fuse-shared-library-linux"] = "file:/etc/fuse-shared-library-linux"' > package.temp.json && \
mv package.temp.json package.json
RUN cd /etc/xen-orchestra/@vates/fuse-vhd && \
jq '.dependencies["fuse-native"] = "file:/etc/fuse-native"' package.json | \
jq '.dependencies["napi-macros"] = "^2.2.2"' > package.temp.json && \
cat package.temp.json && \
mv package.temp.json package.json && \
yarn install --update-checksums --no-lockfile && \
yarn link "fuse-native"
ENV CXXFLAGS="-Wno-implicit-fallthrough"
RUN --mount=type=cache,target=/usr/local/share/.cache cd /etc/xen-orchestra && \
yarn config set network-timeout 300000 && \
yarn link "fuse-native" && \
yarn link "fuse-shared-library-linux"
RUN --mount=type=cache,target=/usr/local/share/.cache cd /etc/xen-orchestra && yarn install --verbose --update-checksums --no-lockfile
RUN cd /etc/xen-orchestra && yarn build
# Install the plugins
RUN find /etc/xen-orchestra/packages/ -maxdepth 1 -mindepth 1 \
-not -name "xo-server" \
-not -name "xo-web" \
-not -name "xo-server-cloud" \
-not -name "xo-server-test" \
-not -name "xo-server-test-plugin" \
-exec ln -s {} /etc/xen-orchestra/packages/xo-server/node_modules \;
#LIBVHDI
FROM arm64v8/node:alpine3.21 as build-libvhdi
WORKDIR /home/node
RUN apk add --no-cache git g++ make bash automake autoconf libtool gettext-dev pkgconf fuse-dev fuse fuse3 fuse3-dev
RUN git clone https://github.com/libyal/libvhdi.git
RUN cd libvhdi && ./synclibs.sh && \
./autogen.sh && \
./configure && \
make && \
make install
##LIBVHDI
FROM arm64v8/node:alpine3.21
MAINTAINER Dusty Armstrong <[email protected]>
LABEL org.opencontainers.image.source https://github.com/dustyarmstrong/xen-orchestra-arm
# Install XO deps
RUN apk add --no-cache \
redis \
python3 \
py3-jinja2 \
lvm2 \
nfs-utils \
net-tools \
cifs-utils \
ca-certificates \
monit \
procps \
curl \
ntfs-3g
# Install forever for starting/stopping Xen-Orchestra
RUN npm install forever -g
# Copy built xen orchestra from builder
COPY --from=build /etc/xen-orchestra /etc/xen-orchestra
COPY --from=build /usr/local/share/.config /usr/local/share/.config
COPY --from=build /etc/fuse-native /etc/fuse-native
COPY --from=build /etc/fuse-shared-library-linux /etc/fuse-shared-library-linux
COPY --from=build-libvhdi /usr/local/bin/vhdimount /usr/local/bin/vhdiinfo /usr/local/bin/
COPY --from=build-libvhdi /usr/local/lib/libvhdi* /usr/local/lib/
RUN rm -rf /etc/fuse-native/.git /etc/fuse-shared-library-linux/.git
# Logging
RUN ln -sf /proc/1/fd/1 /var/log/redis/redis-server.log && \
ln -sf /proc/1/fd/1 /var/log/xo-server.log && \
ln -sf /proc/1/fd/1 /var/log/monit.log
# Healthcheck
ADD healthcheck.sh /healthcheck.sh
RUN chmod +x /healthcheck.sh
HEALTHCHECK --start-period=1m --interval=30s --timeout=5s --retries=2 CMD /healthcheck.sh
# Copy xo-server configuration template
ADD conf/xo-server.toml.j2 /xo-server.toml.j2
# Copy monit configuration
ADD conf/monit-services /etc/monit/conf.d/services
# Copy startup script
ADD start.sh /start.sh
RUN chmod +x /start.sh
WORKDIR /etc/xen-orchestra/packages/xo-server
EXPOSE 80
CMD ["/start.sh"]