-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile-ubuntu
75 lines (61 loc) · 2.35 KB
/
Dockerfile-ubuntu
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
FROM ubuntu:24.04 as build-dep
# Use bash for the shell
SHELL ["/bin/bash", "-c"]
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
ENV NODE_ENV=production
# Install Node v16 (LTS)
ENV NODE_VER="18.20.5"
RUN ARCH= && \
dpkgArch="$(dpkg --print-architecture)" && \
case "${dpkgArch##*-}" in \
amd64) ARCH='x64';; \
ppc64el) ARCH='ppc64le';; \
s390x) ARCH='s390x';; \
arm64) ARCH='arm64';; \
armhf) ARCH='armv7l';; \
i386) ARCH='x86';; \
*) echo "unsupported architecture"; exit 1 ;; \
esac && \
echo "Etc/UTC" > /etc/localtime && \
apt-get update && \
apt-get install -y --no-install-recommends build-essential ca-certificates wget apt-utils git python3 && \
cd ~ && \
wget -q https://nodejs.org/download/release/v$NODE_VER/node-v$NODE_VER-linux-$ARCH.tar.gz && \
tar xf node-v$NODE_VER-linux-$ARCH.tar.gz && \
rm node-v$NODE_VER-linux-$ARCH.tar.gz && \
mv node-v$NODE_VER-linux-$ARCH /opt/node
ENV PATH="${PATH}:/opt/node/bin"
WORKDIR /misskey
RUN npm install -g yarn
COPY . ./
RUN git submodule update --init
RUN yarn install --network-timeout 100000 --pure-lockfile
RUN yarn build
RUN rm -rf .git
FROM ubuntu:24.04
WORKDIR /misskey
# Copy over all the langs needed for runtime
COPY --from=build-dep /opt/node /opt/node
# Add more PATHs to the PATH
ENV PATH="${PATH}:/opt/node/bin"
# Install misskey runtime deps
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
RUN apt-get update && \
apt-get -y --no-install-recommends install \
ffmpeg tini curl libjemalloc-dev libjemalloc2 && \
ln -s /usr/lib/$(uname -m)-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so && \
rm -rf /var/cache && \
rm -rf /var/lib/apt/lists/*
# Copy over misskey source, and dependencies from building
COPY --from=build-dep /misskey/node_modules ./node_modules
COPY --from=build-dep /misskey/built ./built
COPY --from=build-dep /misskey/packages/backend/node_modules ./packages/backend/node_modules
COPY --from=build-dep /misskey/packages/backend/built ./packages/backend/built
COPY --from=build-dep /misskey/packages/client/node_modules ./packages/client/node_modules
COPY . ./
ENV LD_PRELOAD=/usr/local/lib/libjemalloc.so
# Run misskey services in prod mode
ENV NODE_ENV="production"
# Set the container entry point
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["npm", "run", "migrateandstart"]