optimize Dockerfile (#13)

* optimize dockerfile

* fix syntax
This commit is contained in:
CommonLoon102 2020-02-01 20:35:53 +00:00 committed by GitHub
parent 81e4bd248a
commit 639fe15957
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 18 deletions

View File

@ -34,12 +34,28 @@ RUN dotnet_sdk_version=3.1.101 \
# Trigger first run experience by running arbitrary cmd
&& dotnet help
# Install toolchain to build NBlood and the supervisor
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
git \
libgl1-mesa-dev \
libglu1-mesa-dev \
libsdl-mixer1.2-dev \
libsdl1.2-dev \
libsdl2-dev \
libsdl2-mixer-dev \
nano \
nasm \
nginx \
&& rm -rf /var/lib/apt/lists/*
# Installing the NBlood supervisor related things
WORKDIR /supervisor
RUN mkdir -p publish/blood
RUN apt-get update && apt-get install -y \
git \
nano
# Disable cache from this point
ARG CACHEBUST
# Clone NBloodServerSupervisor
RUN git clone https://github.com/CommonLoon102/NBloodServerSupervisor.git
@ -48,17 +64,6 @@ RUN git clone https://github.com/CommonLoon102/NBloodServerSupervisor.git
RUN dotnet publish NBloodServerSupervisor/NBloodServerSupervisor.sln --configuration Release --output publish --self-contained false --runtime linux-x64 \
&& sed -i -e "s/CHANGEME/$(< /dev/urandom tr -dc A-Za-z0-9 | head -c${1:-32};echo;)/g" publish/appsettings.json
# Install toolchain to build NBlood
RUN apt-get update && apt-get install -y \
build-essential \
libgl1-mesa-dev \
libglu1-mesa-dev \
libsdl-mixer1.2-dev \
libsdl1.2-dev \
libsdl2-dev \
libsdl2-mixer-dev \
nasm
# Clone NBlood
RUN git clone https://github.com/CommonLoon102/NBlood.git
@ -67,9 +72,8 @@ RUN cd NBlood \
&& git checkout norender \
&& make blood NORENDER=1
# Install and configure nginx
RUN apt-get update && apt-get install -y nginx \
&& printf '\
# Configure nginx
RUN printf '\
server { \n\
listen 23580; \n\
location / { \n\

View File

@ -32,7 +32,7 @@ After you start the container, the following will happen:
## Deploy the server onto GNU/Linux
1. Install Docker and wget (if you don't have already), for example like this: `sudo snap install docker && sudo apt install wget -y`
2. Download the Dockerfile: `wget https://raw.githubusercontent.com/CommonLoon102/NBloodServerSupervisor/master/Dockerfile --directory-prefix=supervisor`
3. Build the Docker image: `sudo docker build --no-cache -t nblood-supervisor:latest supervisor`
3. Build the Docker image: `sudo docker build --build-arg CACHEBUST=$(date +%s) -t nblood-supervisor:latest supervisor`
4. Navigate to your Blood 1.21 directory where you have the below files.
The files are from stock Blood 1.21, Cryptic Passage, Death Wish 1.6.10 and The Way of Ira 1.0.1
- BLOOD.INI