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
pull/399/head
Angristan 2018-03-23 14:33:51 +01:00 committed by Chocobozzz
parent 0bd78bf30b
commit c7574e8661
2 changed files with 31 additions and 19 deletions

View File

@ -4,19 +4,25 @@ FROM node:8-alpine
RUN apk add --no-cache ffmpeg openssl bash make g++ git \ RUN apk add --no-cache ffmpeg openssl bash make g++ git \
&& apk add --no-cache --repository https://dl-3.alpinelinux.org/alpine/edge/testing/ vips-dev fftw-dev && apk add --no-cache --repository https://dl-3.alpinelinux.org/alpine/edge/testing/ vips-dev fftw-dev
RUN git clone -b master https://github.com/Chocobozzz/PeerTube /app # Add peertube user
WORKDIR /app
RUN bash -c 'yarn install --pure-lockfile && npm run build'
# Configure the application
RUN addgroup -g 991 peertube \ RUN addgroup -g 991 peertube \
&& adduser -D -u 991 -G peertube -h /data peertube && adduser -D -u 991 -G peertube peertube
USER peertube
# Download the latest version
RUN git clone https://github.com/Chocobozzz/PeerTube /app \
&& chown -R peertube:peertube /app
# Install PeerTube
USER peertube
WORKDIR /app
RUN yarn install --pure-lockfile \
&& npm run build
# Configure PeerTube
RUN cp /app/config/default.yaml /app/support/docker/production/config/default.yaml RUN cp /app/config/default.yaml /app/support/docker/production/config/default.yaml
ENV NODE_ENV production ENV NODE_ENV production
ENV NODE_CONFIG_DIR /app/support/docker/production/config/ ENV NODE_CONFIG_DIR /app/support/docker/production/config
# Run the application # Run the application
CMD ["npm", "start"] CMD ["npm", "start"]

View File

@ -5,16 +5,22 @@ RUN apt-get update \
&& apt-get -y install ffmpeg \ && apt-get -y install ffmpeg \
&& rm /var/lib/apt/lists/* -fR && rm /var/lib/apt/lists/* -fR
RUN git clone -b master https://github.com/Chocobozzz/PeerTube /app # Add peertube user
WORKDIR /app
RUN yarn install --pure-lockfile && npm run build
# Configure the application
RUN groupadd -g 991 peertube \ RUN groupadd -g 991 peertube \
&& useradd -u 991 -g peertube -d /data -m peertube && useradd -u 991 -g peertube -m peertube
USER peertube
# Download the latest version
RUN git clone https://github.com/Chocobozzz/PeerTube /app \
&& chown -R peertube:peertube /app
# Install PeerTube
USER peertube
WORKDIR /app
RUN yarn install --pure-lockfile \
&& npm run build
# Configure PeerTube
RUN cp /app/config/default.yaml /app/support/docker/production/config/default.yaml RUN cp /app/config/default.yaml /app/support/docker/production/config/default.yaml
ENV NODE_ENV production ENV NODE_ENV production
ENV NODE_CONFIG_DIR /app/support/docker/production/config ENV NODE_CONFIG_DIR /app/support/docker/production/config