]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - support/docker/production/Dockerfile.stretch
use gosu to fix /data permissions errors
[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)"; \
36 gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4; \
37 gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu; \
38 rm -r "$GNUPGHOME" /usr/local/bin/gosu.asc; \
39 chmod +x /usr/local/bin/gosu; \
40 gosu nobody true; \
41 \
42 apt-get purge -y --auto-remove wget
e8395f02 43
c7574e86
A
44# Download the latest version
45RUN git clone https://github.com/Chocobozzz/PeerTube /app \
46 && chown -R peertube:peertube /app
e8395f02 47
c7574e86 48# Install PeerTube
e8395f02 49USER peertube
c7574e86
A
50WORKDIR /app
51
52RUN yarn install --pure-lockfile \
53 && npm run build
e8395f02 54
c7574e86 55# Configure PeerTube
95540ed2 56RUN cp /app/config/default.yaml /app/support/docker/production/config/default.yaml
e8395f02 57ENV NODE_ENV production
58ENV NODE_CONFIG_DIR /app/support/docker/production/config
59
399d20ea
FP
60USER root
61RUN mkdir /data && chown peertube:peertube /data
62VOLUME /data
63
64COPY docker-entrypoint.sh /usr/local/bin/
65ENTRYPOINT ["docker-entrypoint.sh"]
66
e8395f02 67# Run the application
68CMD ["npm", "start"]
e8395f02 69EXPOSE 9000