-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(docker): configure botpress user for the docker image (#11937)
* chore(docker): configure botpress user for the docker image * fix permissions not being set properly * run bins as botpress user + mount permissions fix * add warning when running botpress as root
- Loading branch information
Showing
6 changed files
with
64 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,39 @@ | ||
FROM ubuntu:20.04 | ||
|
||
ADD . /botpress | ||
WORKDIR /botpress | ||
ENV BP_WORKDIR=/botpress | ||
ENV BP_USER=botpress | ||
ENV BP_GROUP=botpress | ||
ENV BP_DATA_PATH $BP_WORKDIR/data | ||
|
||
ADD . $BP_WORKDIR | ||
WORKDIR $BP_WORKDIR | ||
|
||
RUN apt update && \ | ||
apt install -y wget ca-certificates && \ | ||
update-ca-certificates && \ | ||
wget -O duckling https://s3.amazonaws.com/botpress-binaries/duckling-example-exe && \ | ||
chmod +x duckling && \ | ||
chmod +x bp && \ | ||
chgrp -R 0 /botpress && \ | ||
chmod -R g=u /botpress && \ | ||
apt install -y tzdata && \ | ||
ln -fs /usr/share/zoneinfo/UTC /etc/localtime && \ | ||
dpkg-reconfigure --frontend noninteractive tzdata && \ | ||
./bp extract | ||
dpkg-reconfigure --frontend noninteractive tzdata | ||
|
||
RUN chmod +x duckling && chmod +x bp | ||
|
||
RUN ./bp extract | ||
|
||
# Creates botpress user and group | ||
RUN groupadd -g 999 $BP_GROUP && \ | ||
useradd -m -r -u 999 -g $BP_GROUP $BP_USER | ||
|
||
# Sets ownership of the workdir to the botpress user | ||
RUN chown -R $BP_USER:$BP_GROUP $BP_WORKDIR | ||
|
||
ENV BP_MODULE_NLU_DUCKLINGURL=http://localhost:8000 | ||
ENV BP_IS_DOCKER=true | ||
|
||
ENV LANG=C.UTF-8 | ||
EXPOSE 3000 | ||
|
||
CMD ./duckling & ./bp | ||
COPY docker-entrypoint.sh /usr/local/bin/ | ||
ENTRYPOINT ["docker-entrypoint.sh"] | ||
|
||
CMD su - botpress -c "$BP_WORKDIR/duckling & $BP_WORKDIR/bp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
# Creates the Botpress data folder and sets botpress as the owner | ||
mkdir -p $BP_DATA_PATH; | ||
chown -R $BP_USER:$BP_GROUP $BP_DATA_PATH; | ||
|
||
# Executes the command (CMD) passed to the container | ||
exec "$@"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters