]>
Commit | Line | Data |
---|---|---|
1 | FROM node:8-stretch | |
2 | ||
3 | RUN set -ex; \ | |
4 | if ! command -v gpg > /dev/null; then \ | |
5 | apt-get update; \ | |
6 | apt-get install -y --no-install-recommends \ | |
7 | gnupg \ | |
8 | dirmngr \ | |
9 | ; \ | |
10 | rm -rf /var/lib/apt/lists/*; \ | |
11 | fi | |
12 | ||
13 | # Install dependencies | |
14 | RUN apt-get update \ | |
15 | && apt-get -y install ffmpeg \ | |
16 | && rm /var/lib/apt/lists/* -fR | |
17 | ||
18 | # Add peertube user | |
19 | RUN groupadd -r peertube \ | |
20 | && useradd -r -g peertube -m peertube | |
21 | ||
22 | # grab gosu for easy step-down from root | |
23 | RUN set -eux; \ | |
24 | apt-get update; \ | |
25 | apt-get install -y gosu; \ | |
26 | rm -rf /var/lib/apt/lists/*; \ | |
27 | gosu nobody true | |
28 | ||
29 | # Install PeerTube | |
30 | WORKDIR /app | |
31 | COPY . ./ | |
32 | RUN chown -R peertube:peertube /app | |
33 | ||
34 | USER peertube | |
35 | ||
36 | RUN yarn install --pure-lockfile \ | |
37 | && npm run build \ | |
38 | && rm -r ./node_modules ./client/node_modules \ | |
39 | && yarn install --pure-lockfile --production \ | |
40 | && yarn cache clean | |
41 | ||
42 | USER root | |
43 | ||
44 | RUN mkdir /data /config | |
45 | RUN chown -R peertube:peertube /data /config | |
46 | ||
47 | ENV NODE_ENV production | |
48 | ENV NODE_CONFIG_DIR /config | |
49 | ||
50 | VOLUME /data | |
51 | VOLUME /config | |
52 | ||
53 | COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh | |
54 | ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"] | |
55 | ||
56 | # Run the application | |
57 | CMD ["npm", "start"] | |
58 | EXPOSE 9000 |