]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/docker/production/Dockerfile.stretch
Fix dockerfile
[github/Chocobozzz/PeerTube.git] / support / docker / production / Dockerfile.stretch
CommitLineData
e8395f02 1FROM node:8-stretch
2
399d20ea
FP
3RUN 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/*; \
11fi
12
e8395f02 13# Install dependencies
14RUN apt-get update \
c7574e86
A
15 && apt-get -y install ffmpeg \
16 && rm /var/lib/apt/lists/* -fR
e8395f02 17
c7574e86 18# Add peertube user
399d20ea
FP
19RUN groupadd -r peertube \
20 && useradd -r -g peertube -m peertube
21
22# grab gosu for easy step-down from root
23# https://github.com/tianon/gosu/releases
24ENV GOSU_VERSION 1.10
25RUN set -ex; \
26 \
27 fetchDeps='ca-certificates wget'; \
28 apt-get update; \
29 apt-get install -y --no-install-recommends $fetchDeps; \
30 rm -rf /var/lib/apt/lists/*; \
31 \
32 dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
33 wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch"; \
34 wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
35 export GNUPGHOME="$(mktemp -d)"; \
4aeb67a5
C
36 for server in $(shuf -e ha.pool.sks-keyservers.net \
37 hkp://p80.pool.sks-keyservers.net:80 \
38 keyserver.ubuntu.com \
39 hkp://keyserver.ubuntu.com:80 \
40 pgp.mit.edu) ; do \
41 gpg --keyserver "$server" --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 && break || : ; \
42 done; \
399d20ea 43 gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
33837e8b 44 rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc; \
399d20ea
FP
45 chmod +x /usr/local/bin/gosu; \
46 gosu nobody true; \
47 \
48 apt-get purge -y --auto-remove wget
e8395f02 49
c7574e86 50# Install PeerTube
c7574e86 51WORKDIR /app
c36d5a6b
C
52COPY . ./
53RUN chown -R peertube:peertube /app
4aeb67a5
C
54
55USER peertube
c7574e86
A
56
57RUN yarn install --pure-lockfile \
d1e59223
C
58 && npm run build \
59 && rm -r ./node_modules ./client/node_modules \
904a463c 60 && yarn install --pure-lockfile --production \
e5095ca5 61 && yarn cache clean
e8395f02 62
fd5e57bb
C
63USER root
64
65RUN mkdir /data /config
66RUN chown -R peertube:peertube /data /config
67
e8395f02 68ENV NODE_ENV production
fd5e57bb 69ENV NODE_CONFIG_DIR /config
e8395f02 70
399d20ea 71VOLUME /data
fd5e57bb 72VOLUME /config
399d20ea 73
4aeb67a5
C
74COPY ./support/docker/production/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
75ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
399d20ea 76
e8395f02 77# Run the application
78CMD ["npm", "start"]
e8395f02 79EXPOSE 9000