]>
Commit | Line | Data |
---|---|---|
1 | FROM node:12-bullseye-slim | |
2 | ||
3 | # Allow to pass extra options to the npm run build | |
4 | # eg: --light --light-fr to not build all client languages | |
5 | # (speed up build time if i18n is not required) | |
6 | ARG NPM_RUN_BUILD_OPTS | |
7 | ||
8 | # Install dependencies | |
9 | RUN apt update \ | |
10 | && apt install -y --no-install-recommends openssl ffmpeg python ca-certificates gnupg gosu build-essential curl \ | |
11 | && gosu nobody true \ | |
12 | && rm /var/lib/apt/lists/* -fR | |
13 | ||
14 | # Add peertube user | |
15 | RUN groupadd -r peertube \ | |
16 | && useradd -r -g peertube -m peertube | |
17 | ||
18 | # Install PeerTube | |
19 | COPY --chown=peertube:peertube . /app | |
20 | WORKDIR /app | |
21 | ||
22 | USER peertube | |
23 | ||
24 | RUN yarn install --pure-lockfile --network-timeout 600000 \ | |
25 | && npm run build -- $NPM_RUN_BUILD_OPTS \ | |
26 | && rm -r ./node_modules ./client/node_modules \ | |
27 | && yarn install --pure-lockfile --production --network-timeout 600000 \ | |
28 | && yarn cache clean | |
29 | ||
30 | USER root | |
31 | ||
32 | RUN mkdir /data /config | |
33 | RUN chown -R peertube:peertube /data /config | |
34 | ||
35 | ENV NODE_ENV production | |
36 | ENV NODE_CONFIG_DIR /app/config:/app/support/docker/production/config:/config | |
37 | ENV PEERTUBE_LOCAL_CONFIG /config | |
38 | ||
39 | VOLUME /data | |
40 | VOLUME /config | |
41 | ||
42 | COPY ./support/docker/production/entrypoint.sh /usr/local/bin/entrypoint.sh | |
43 | ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | |
44 | ||
45 | # Expose API and RTMP | |
46 | EXPOSE 9000 1935 | |
47 | ||
48 | # Run the application | |
49 | CMD ["npm", "start"] |