From c3d9e2d3b34a32b33f9646ca18acddad60a94bbf Mon Sep 17 00:00:00 2001 From: shockrah Date: Tue, 9 Feb 2021 15:15:16 -0800 Subject: [PATCH] +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 --- docker/Dockerfile | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 3dcb6a8..87a30fc 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,22 +1,34 @@ -# This File basically sets up a fresh alpine install with all the things -# required for setting up a new freechat instance +FROM mysql:8.0 -# NOTE: this is the production docker so its purposefully tiny to let others -# build what they want on it -# It's really small and missing basically every feature you _want_ +# Prelim updates +RUN apt-get update -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 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 # All keys present but not set to anything(null)