mirror of
https://github.com/matrixgpt/matrix-chatgpt-bot.git
synced 2024-09-28 20:15:56 +00:00
Merge pull request #22 from bertybuttface/main
Fixes for Docker and Permissions
This commit is contained in:
commit
ec793d01fb
23
Dockerfile
23
Dockerfile
@ -1,4 +1,4 @@
|
||||
FROM node:18 as builder
|
||||
FROM satantime/puppeteer-node:18.12.1 as builder
|
||||
|
||||
# Create app directory
|
||||
WORKDIR /usr/src/app
|
||||
@ -16,7 +16,7 @@ COPY . .
|
||||
RUN yarn build
|
||||
|
||||
|
||||
FROM node:18-slim
|
||||
FROM satantime/puppeteer-node:18.12.1-slim
|
||||
|
||||
RUN mkdir -p /home/pptruser/Downloads
|
||||
# Create app directory
|
||||
@ -29,32 +29,21 @@ ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt update -qq \
|
||||
&& apt install -qq -y --no-install-recommends \
|
||||
curl \
|
||||
git \
|
||||
gnupg \
|
||||
libgconf-2-4 \
|
||||
libxss1 \
|
||||
libxtst6 \
|
||||
python \
|
||||
g++ \
|
||||
build-essential \
|
||||
chromium \
|
||||
chromium-sandbox \
|
||||
dumb-init \
|
||||
fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& rm -rf /src/*.deb
|
||||
|
||||
# To run Headful mode, you will need to have a display, which is not present in a server.
|
||||
# To avoid this, we will use Xvfb, and create a fake display, so the chrome will think there is a display and run properly.
|
||||
# So we just need to install Xvfb and Puppeteer related dependencies.
|
||||
RUN apt-get update && apt-get install -yq gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget x11vnc x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps xvfb
|
||||
RUN apt-get update && apt-get install -yq \
|
||||
x11vnc x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps xvfb
|
||||
|
||||
# Install app dependencies
|
||||
COPY package*.json ./
|
||||
|
||||
COPY .env .env
|
||||
|
||||
RUN yarn install --frozen-lockfile --production && yarn cache clean
|
||||
|
||||
COPY --from=builder /usr/src/app/dist ./dist
|
||||
@ -64,8 +53,10 @@ RUN npm install puppeteer@19.4.1 \
|
||||
# same layer as npm install to keep re-chowned files from using up several hundred MBs more space
|
||||
&& groupadd -r pptruser && useradd -rm -g pptruser -G audio,video pptruser \
|
||||
&& chown -R pptruser:pptruser /home/pptruser
|
||||
USER pptruser
|
||||
|
||||
RUN mkdir /storage && \
|
||||
chown -R pptruser:pptruser /storage
|
||||
USER pptruser
|
||||
VOLUME /storage
|
||||
|
||||
ENV DATA_PATH="/storage"
|
||||
|
@ -50,7 +50,8 @@ MATRIX_ACCESS_TOKEN=
|
||||
MATRIX_BOT_PASSWORD=
|
||||
|
||||
# Matrix Configurable Settings Defaults (optional)
|
||||
MATRIX_DEFAULT_PREFIX="!chatgpt " # Leave prefix blank to reply to all messages
|
||||
# Leave prefix blank to reply to all messages
|
||||
MATRIX_DEFAULT_PREFIX=!chatgpt
|
||||
MATRIX_DEFAULT_PREFIX_REPLY=false
|
||||
|
||||
# Matrix Feature Flags (optional)
|
||||
@ -78,7 +79,7 @@ recomend following the prompts at https://element.io/get-started to download and
|
||||
|
||||
```
|
||||
docker build . -t matrix-chatgpt-bot
|
||||
docker run -it -v /full-path-not-relative-path/storage:/storage matrix-chatgpt-bot
|
||||
docker run -it -v storage:/storage --env-file=./.env --name matrix-chatgpt-bot matrix-chatgpt-bot
|
||||
```
|
||||
|
||||
Note: Without -it flags in the command above you won't be able to stop the container using Ctrl-C
|
||||
|
Loading…
Reference in New Issue
Block a user