Improve dev Dockerfile (#1333)

* Improve dev Dockerfile

Use Docker best-practices for the development Dockerfile. Save 3Mo.

* Update support/docker/dev/Dockerfile

Co-Authored-By: pichouk <kyane@kyane.fr>
This commit is contained in:
Kyâne Pichou 2018-10-22 14:37:40 +02:00 committed by Chocobozzz
parent 7cf3e57376
commit 4293e362af
1 changed files with 25 additions and 27 deletions

View File

@ -6,43 +6,41 @@ ENV DEBIAN_FRONTEND=noninteractive
# Install PeerTube's dependencies. # Install PeerTube's dependencies.
# Packages are from https://github.com/Chocobozzz/PeerTube#dependencies # Packages are from https://github.com/Chocobozzz/PeerTube#dependencies
RUN apt-get update -q && apt-get install -qy \ RUN apt-get update -q && apt-get install -qy \
curl \ curl \
nano \ ffmpeg \
ffmpeg \ g++ \
postgresql \ git \
postgresql-contrib \ gnupg \
openssl \ make \
g++ \ nano \
make \ openssl \
redis-server \ postgresql \
git \ postgresql-contrib \
gnupg redis-server \
&& curl -sL https://deb.nodesource.com/setup_8.x | bash - \
# Install NodeJS 8.x && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \ && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
apt-get install -y nodejs && apt-get update \
&& apt-get install -qy nodejs yarn \
# Install Yarn && rm -rf /var/lib/apt/lists/*
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && apt-get install yarn
# Download PeerTube's source code. # Download PeerTube's source code.
RUN git clone -b develop https://github.com/Chocobozzz/PeerTube /home/user/PeerTube RUN git clone -b develop https://github.com/Chocobozzz/PeerTube /home/user/PeerTube
WORKDIR /home/user/PeerTube WORKDIR /home/user/PeerTube
# Install dependencies. # Copy postgresql setup script
RUN yarn install --pure-lockfile
# Configure and run PeerTube.
COPY setup_postgres.sql /tmp/ COPY setup_postgres.sql /tmp/
RUN service postgresql start \
&& su postgres -c "psql --file=/tmp/setup_postgres.sql" # Install Node.js dependencies and setup PostgreSQL
RUN yarn install --pure-lockfile \
&& service postgresql start \
&& su postgres -c "psql --file=/tmp/setup_postgres.sql"
# Expose PeerTube sources as a volume # Expose PeerTube sources as a volume
VOLUME /home/user/PeerTube VOLUME /home/user/PeerTube
# Expose API and frontend
EXPOSE 3000 9000 EXPOSE 3000 9000
# Start PostgreSQL and Redis # Start PostgreSQL and Redis
CMD service postgresql start && redis-server CMD ["service postgresql start && redis-server"]