From 221f007c076fbca75ed6aeb2a0ea229e2de34405 Mon Sep 17 00:00:00 2001 From: leoujz Date: Tue, 10 Aug 2021 16:02:55 +0800 Subject: [PATCH] Update tutorial.md (#1018) --- docs/add-ons/tutorial.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/add-ons/tutorial.md b/docs/add-ons/tutorial.md index dc6535cc..38aba00f 100644 --- a/docs/add-ons/tutorial.md +++ b/docs/add-ons/tutorial.md @@ -106,18 +106,26 @@ To do this, we will need to update our files as follows: - `config.json`: Make the port from the container available on the host - `run.sh`: Run the Python 3 command to start the HTTP server -Add to your `Dockerfile` before `RUN`: +Update your `Dockerfile`: ```dockerfile ARG BUILD_FROM FROM $BUILD_FROM +ENV LANG C.UTF-8 + # Install requirements for add-on RUN apk add --no-cache python3 # Python 3 HTTP Server serves the current working dir # So let's set it to our add-on persistent data directory. WORKDIR /data + +# Copy data for add-on +COPY run.sh / +RUN chmod a+x /run.sh + +CMD [ "/run.sh" ] ``` Add "ports" to `config.json`. This will make TCP on port 8000 inside the container available on the host on port 8000. @@ -142,6 +150,10 @@ Add "ports" to `config.json`. This will make TCP on port 8000 inside the contain Update `run.sh` to start the Python 3 server: ```shell +#!/usr/bin/with-contenv bashio + +echo Hello world! + python3 -m http.server 8000 ```