+Putting apt-get all in one place

+--no-install-recommends
+Allowing curl pipe to fail early with previous SHELL command
* Using WORKDIR instead of cd
This commit is contained in:
shockrah 2021-02-09 15:15:16 -08:00
parent 8dd42606bd
commit c3d9e2d3b3

View File

@ -1,22 +1,34 @@
# This File basically sets up a fresh alpine install with all the things FROM mysql:8.0
# required for setting up a new freechat instance
# NOTE: this is the production docker so its purposefully tiny to let others # Prelim updates
# build what they want on it RUN apt-get update
# It's really small and missing basically every feature you _want_
FROM nginx:alpine # Reasoning for each:
# git: Pulling from git remotes
# nginx: reverse proxy + offloading https responsibility to it
# that last point avoids slow loris attacks as nginx is hardened against them
# curl: download rustup setup script
# libmysqlclient-dev: required for building json-api to connect to mysql servers
# build-essential: compiling rust
# libssl-dev: for compiling json-api
RUN apt-get install git nginx \
curl libmysqlclient-dev build-essential \
libssl-dev \
-y --no-install-recommends
# Default rust toolchain
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | \
sh -s -- --default-toolchain=stable
ENV path="/root/.cargo/bin:${PATH}"
# First we simply install all the things we may need to build/
RUN apk add --no-cache mysql
RUN apk add --no-cache nginx
RUN apk add --no-cache openssl-dev
RUN apk add --no-cache cargo
RUN apk add --no-cache git
# Now we being the freechat installation process # Now we being the freechat installation process
RUN git clone https://gitlab.com/shockrah/freechat.git/ /opt/freechat/ RUN git clone https://gitlab.com/shockrah/freechat.git/ /opt/freechat/
RUN cd /opt/freechat/ && sh docker-auto-build.sh --no-cargo-cache WORKDIR /opt/freechat/
RUN sh docker-auto-build.sh --no-cargo-cache
# Sample env file to copy into the base image # Sample env file to copy into the base image
# All keys present but not set to anything(null) # All keys present but not set to anything(null)