Run in docker

This commit is contained in:
neumond 2020-07-18 13:36:19 +03:00
parent 3c8aa784bc
commit db07997335
2 changed files with 38 additions and 8 deletions

24
Dockerfile Normal file
View file

@ -0,0 +1,24 @@
# docker build --tag neumond/python-computer-craft:<version> .
# docker run -it -p 8080:8080 neumond/python-computer-craft:<version>
FROM python:3.8-alpine
RUN apk add --update \
gcc musl-dev \
build-base
WORKDIR /wheels
ENV PIP_DISABLE_PIP_VERSION_CHECK=1
RUN pip install wheel
RUN pip download computercraft
RUN pip wheel -w . computercraft
RUN ls -l
FROM python:3.8-alpine
WORKDIR /wheels
COPY --from=0 /wheels/*.whl ./wheels/
RUN pip install --no-index -f ./wheels computercraft
WORKDIR /home
ENV PYTHONDONTWRITEBYTECODE=1
EXPOSE 8080/tcp
ENTRYPOINT [ "python", "-m", "computercraft.server" ]

View file

@ -4,13 +4,8 @@
[(read more)](https://nedbatchelder.com/blog/201206/eval_really_is_dangerous.html).
Never use code in this repo if you don't trust your players!
1. Download and install wheel from github releases
```sh
pip install computercraft
```
2. Enable localhost in mod server config
1. Before you start Minecraft, enable localhost in mod server config
In case of singleplayer it's located inside your saves folder.
In case of multiplayer check your server folder.
@ -23,13 +18,24 @@ Never use code in this repo if you don't trust your players!
action = "allow" # change here deny to allow
```
3. Start python server:
2. Install & start python language server
Choose one of the following:
Docker way:
```sh
docker run -it -p 8080:8080 neumond/python-computer-craft
```
Install & run manually:
```sh
pip install computercraft
python -m computercraft.server
```
4. In minecraft, open up any computer and type:
3. Start Minecraft, open up any computer and type:
```sh
wget http://127.0.0.1:8080/ py