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 # Trigger first run experience by running arbitrary cmd
&& dotnet help && 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 # Installing the NBlood supervisor related things
WORKDIR /supervisor WORKDIR /supervisor
RUN mkdir -p publish/blood RUN mkdir -p publish/blood
RUN apt-get update && apt-get install -y \
git \ # Disable cache from this point
nano ARG CACHEBUST
# Clone NBloodServerSupervisor # Clone NBloodServerSupervisor
RUN git clone https://github.com/CommonLoon102/NBloodServerSupervisor.git 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 \ 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 && 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 # Clone NBlood
RUN git clone https://github.com/CommonLoon102/NBlood.git RUN git clone https://github.com/CommonLoon102/NBlood.git
@ -67,9 +72,8 @@ RUN cd NBlood \
&& git checkout norender \ && git checkout norender \
&& make blood NORENDER=1 && make blood NORENDER=1
# Install and configure nginx # Configure nginx
RUN apt-get update && apt-get install -y nginx \ RUN printf '\
&& printf '\
server { \n\ server { \n\
listen 23580; \n\ listen 23580; \n\
location / { \n\ location / { \n\

View File

@ -32,7 +32,7 @@ After you start the container, the following will happen:
## Deploy the server onto GNU/Linux ## 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` 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` 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. 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 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 - BLOOD.INI