forked from tcpipuk/schildichat-web-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
67 lines (57 loc) · 1.83 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
# Build stage
FROM alpine:latest AS build
# Update and install the required packages
RUN apk --no-cache add \
bash \
curl \
gcc \
g++ \
git \
jq \
make \
nodejs \
npm \
openssl-dev \
python3 \
tcl \
vim \
yarn
# Install Rust
RUN curl -sSf https://sh.rustup.rs | sh -s -- -y \
&& echo 'export PATH="$PATH:$HOME/.cargo/bin"' >> ~/.bashrc \
&& source ~/.bashrc
# Clone the SchildiChat repository
WORKDIR /build
RUN git clone -b master --recurse-submodules https://github.com/SchildiChat/schildichat-desktop.git
# Handle matrix-js-sdk
WORKDIR /build/schildichat-desktop/matrix-js-sdk
RUN yarnpkg unlink &>/dev/null || true \
&& yarnpkg link \
&& yarnpkg install
# Handle matrix-react-sdk
WORKDIR /build/schildichat-desktop/matrix-react-sdk
RUN yarnpkg link matrix-js-sdk \
&& yarnpkg unlink &>/dev/null || true \
&& yarnpkg link \
&& yarnpkg install
# Handle element-web
WORKDIR /build/schildichat-desktop/element-web
RUN yarnpkg link matrix-js-sdk \
&& yarnpkg link matrix-react-sdk \
&& yarnpkg install
# Handle element-desktop
WORKDIR /build/schildichat-desktop/element-desktop
RUN yarnpkg install \
&& ln -s ../element-web/webapp ./ || true
# Build SchildiChat directly into /web-output
WORKDIR /build/schildichat-desktop
RUN cp configs/sc/config.json element-web/ \
&& yarnpkg --cwd element-web dist \
&& echo "$(grep version element-desktop/package.json | sed 's|.*: \"\(.*\)\",|\1|')" > element-web/webapp/version \
&& mkdir -p /schildichat-web \
&& tar -xzf element-web/dist/schildichat-web-*.tar.gz --strip-components=1 -C /schildichat-web \
&& cp configs/sc/config.json /schildichat-web/
# Final stage
FROM nginx:mainline-alpine-slim
# Copy the built web files to the Nginx directory
COPY --from=build /schildichat-web /usr/share/nginx/html