diff options
author | Angristan <Angristan@users.noreply.github.com> | 2018-03-23 14:33:51 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-23 14:33:51 +0100 |
commit | c7574e8661d62982516ac21c661964b49adbc850 (patch) | |
tree | b87d845f100c46f93010fe236a5a5906383724d8 | |
parent | 0bd78bf30b2ae159791bdc90d17ed18e0327f621 (diff) | |
download | PeerTube-c7574e8661d62982516ac21c661964b49adbc850.tar.gz PeerTube-c7574e8661d62982516ac21c661964b49adbc850.tar.zst PeerTube-c7574e8661d62982516ac21c661964b49adbc850.zip |
Run the installation as the peertube user inside the Docker image (#385)
* Run the installation as the peertube user
* Run the installation as the peertube user
-rw-r--r-- | support/docker/production/Dockerfile.alpine | 20 | ||||
-rw-r--r-- | support/docker/production/Dockerfile.stretch | 22 |
2 files changed, 27 insertions, 15 deletions
diff --git a/support/docker/production/Dockerfile.alpine b/support/docker/production/Dockerfile.alpine index 8ce0bb98b..58a49d4a0 100644 --- a/support/docker/production/Dockerfile.alpine +++ b/support/docker/production/Dockerfile.alpine | |||
@@ -4,19 +4,25 @@ FROM node:8-alpine | |||
4 | RUN apk add --no-cache ffmpeg openssl bash make g++ git \ | 4 | RUN apk add --no-cache ffmpeg openssl bash make g++ git \ |
5 | && apk add --no-cache --repository https://dl-3.alpinelinux.org/alpine/edge/testing/ vips-dev fftw-dev | 5 | && apk add --no-cache --repository https://dl-3.alpinelinux.org/alpine/edge/testing/ vips-dev fftw-dev |
6 | 6 | ||
7 | RUN git clone -b master https://github.com/Chocobozzz/PeerTube /app | 7 | # Add peertube user |
8 | RUN addgroup -g 991 peertube \ | ||
9 | && adduser -D -u 991 -G peertube peertube | ||
8 | 10 | ||
9 | WORKDIR /app | 11 | # Download the latest version |
10 | RUN bash -c 'yarn install --pure-lockfile && npm run build' | 12 | RUN git clone https://github.com/Chocobozzz/PeerTube /app \ |
13 | && chown -R peertube:peertube /app | ||
11 | 14 | ||
12 | # Configure the application | 15 | # Install PeerTube |
13 | RUN addgroup -g 991 peertube \ | ||
14 | && adduser -D -u 991 -G peertube -h /data peertube | ||
15 | USER peertube | 16 | USER peertube |
17 | WORKDIR /app | ||
18 | |||
19 | RUN yarn install --pure-lockfile \ | ||
20 | && npm run build | ||
16 | 21 | ||
22 | # Configure PeerTube | ||
17 | RUN cp /app/config/default.yaml /app/support/docker/production/config/default.yaml | 23 | RUN cp /app/config/default.yaml /app/support/docker/production/config/default.yaml |
18 | ENV NODE_ENV production | 24 | ENV NODE_ENV production |
19 | ENV NODE_CONFIG_DIR /app/support/docker/production/config/ | 25 | ENV NODE_CONFIG_DIR /app/support/docker/production/config |
20 | 26 | ||
21 | # Run the application | 27 | # Run the application |
22 | CMD ["npm", "start"] | 28 | CMD ["npm", "start"] |
diff --git a/support/docker/production/Dockerfile.stretch b/support/docker/production/Dockerfile.stretch index c616194e6..b1905b3a8 100644 --- a/support/docker/production/Dockerfile.stretch +++ b/support/docker/production/Dockerfile.stretch | |||
@@ -2,19 +2,25 @@ FROM node:8-stretch | |||
2 | 2 | ||
3 | # Install dependencies | 3 | # Install dependencies |
4 | RUN apt-get update \ | 4 | RUN apt-get update \ |
5 | && apt-get -y install ffmpeg \ | 5 | && apt-get -y install ffmpeg \ |
6 | && rm /var/lib/apt/lists/* -fR | 6 | && rm /var/lib/apt/lists/* -fR |
7 | 7 | ||
8 | RUN git clone -b master https://github.com/Chocobozzz/PeerTube /app | 8 | # Add peertube user |
9 | RUN groupadd -g 991 peertube \ | ||
10 | && useradd -u 991 -g peertube -m peertube | ||
9 | 11 | ||
10 | WORKDIR /app | 12 | # Download the latest version |
11 | RUN yarn install --pure-lockfile && npm run build | 13 | RUN git clone https://github.com/Chocobozzz/PeerTube /app \ |
14 | && chown -R peertube:peertube /app | ||
12 | 15 | ||
13 | # Configure the application | 16 | # Install PeerTube |
14 | RUN groupadd -g 991 peertube \ | ||
15 | && useradd -u 991 -g peertube -d /data -m peertube | ||
16 | USER peertube | 17 | USER peertube |
18 | WORKDIR /app | ||
19 | |||
20 | RUN yarn install --pure-lockfile \ | ||
21 | && npm run build | ||
17 | 22 | ||
23 | # Configure PeerTube | ||
18 | RUN cp /app/config/default.yaml /app/support/docker/production/config/default.yaml | 24 | RUN cp /app/config/default.yaml /app/support/docker/production/config/default.yaml |
19 | ENV NODE_ENV production | 25 | ENV NODE_ENV production |
20 | ENV NODE_CONFIG_DIR /app/support/docker/production/config | 26 | ENV NODE_CONFIG_DIR /app/support/docker/production/config |