Minetrack
Minetrack copied to clipboard
Update Dockerfile
Solution #225 is failing since node:15
image is based on debian 9, whose original upstream apt repository has been taken down already, causing docker reporting build failure. To even have trial, manually modifying Dockerfile to let apt client use an archive apt repository is required. Docker image based on https://github.com/Cryptkeeper/Minetrack/blob/7a76c8b45d27ebaee925906ebf8c2bf24c881c94/Dockerfile occupies more than 1GB on disk as seen from docker image ls
. In addition, because servers.json
and config.json
all lie in the project's root directory, changing configuration or adding/removing server is with frustrating inconvenience. Worse, mounting the whole project's root directory on a new directory on host has great possibility of following data loss (Project files being wiped off upon mounting).
This PR introduces several updates:
-
config.json
,servers.json
, log file and Sqlite database file in dedicateddata
directory. - In Dockerfile, use node 18 alpine as base image, run minetrack as
www-data
user (id 33). All project files can be seen in/app
directory in docker container./app/data
directory will be a volume accessible on host by default. - Bump version of
@babel/core
andparcel
~~(In my Windows environmentparcel
reports error. Updating resolved such issue, seemingly, I don't really know why.)~~
This PR also makes patches to .gitignore
and .dockerignore
.
Docker Image based on the new Dockerfile reveals lower disk occupation, approximately 570MB as seen from docker image ls
. ~~Gitlab container registry reports 170M.~~
Commands listed below are used to setup my minetrack instance:
cd ~
mkdir -p trial-gh-minetrack
cd trial-gh-minetrack
git clone https://github.com/CrimsonEdgeHope/Minetrack
cd Minetrack
git fetch
git checkout origin/p1
docker build . -t gh-minetrack:trial
docker create --name gh-minetrack-trial-1 -v gh-minetrack-trial-volume:/app/data gh-minetrack:trial
cd /var/lib/docker/volumes/gh-minetrack-trial-volume/_data
cat << EOF > servers.json
[
{
"name": "Test",
"ip": "tojointheserverjustputthisipintoyourlittleaddressbox.lol",
"type": "PC"
}
]
EOF
docker start gh-minetrack-trial-1
docker logs gh-minetrack-trial-1