Skip to content

Commit 4883934

Browse files
authored
Merge pull request doccano#266 from CatalystCode/enhancement/docker-avoid-root
Enhancement/Avoid running docker image as root
2 parents 9d7cbfe + 48c3d48 commit 4883934

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,21 @@ RUN cd /doccano \
2929

3030
FROM python:${PYTHON_VERSION}-slim AS runtime
3131

32+
RUN useradd -ms /bin/sh doccano
33+
3234
COPY --from=builder /deps /deps
3335
RUN pip install --no-cache-dir /deps/*.whl
3436

35-
COPY --from=cleaner /doccano /doccano
37+
COPY --from=cleaner --chown=doccano:doccano /doccano /doccano
3638

3739
ENV DEBUG="True"
3840
ENV SECRET_KEY="change-me-in-production"
39-
ENV PORT="80"
41+
ENV PORT="8000"
4042
ENV WORKERS="2"
4143
ENV GOOGLE_TRACKING_ID=""
4244
ENV AZURE_APPINSIGHTS_IKEY=""
4345

46+
USER doccano
4447
WORKDIR /doccano
4548
EXPOSE ${PORT}
4649

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Depending on your installation method, there are two options:
130130
First, run a Docker container:
131131

132132
```bash
133-
docker run -d --name doccano -p 8000:80 chakkiworks/doccano
133+
docker run -d --name doccano -p 8000:8000 chakkiworks/doccano
134134
```
135135

136136
Then, execute `create-admin.sh` script for creating a superuser.

azuredeploy.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,14 @@
271271
"linuxFxVersion": "[concat('DOCKER|', parameters('dockerImageName'))]",
272272
"alwaysOn": true,
273273
"appSettings": [
274+
{
275+
"name": "WEBSITES_PORT",
276+
"value": "8000"
277+
},
278+
{
279+
"name": "PORT",
280+
"value": "8000"
281+
},
274282
{
275283
"name": "WEBSITES_ENABLE_APP_SERVICE_STORAGE",
276284
"value": "false"

0 commit comments

Comments
 (0)