mirror of
https://github.com/matrixgpt/matrix-chatgpt-bot.git
synced 2024-06-29 08:02:16 +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
|
# Create app directory
|
||||||
WORKDIR /usr/src/app
|
WORKDIR /usr/src/app
|
||||||
|
@ -16,7 +16,7 @@ COPY . .
|
||||||
RUN yarn build
|
RUN yarn build
|
||||||
|
|
||||||
|
|
||||||
FROM node:18-slim
|
FROM satantime/puppeteer-node:18.12.1-slim
|
||||||
|
|
||||||
RUN mkdir -p /home/pptruser/Downloads
|
RUN mkdir -p /home/pptruser/Downloads
|
||||||
# Create app directory
|
# Create app directory
|
||||||
|
@ -29,32 +29,21 @@ ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
RUN apt update -qq \
|
RUN apt update -qq \
|
||||||
&& apt install -qq -y --no-install-recommends \
|
&& apt install -qq -y --no-install-recommends \
|
||||||
curl \
|
|
||||||
git \
|
|
||||||
gnupg \
|
|
||||||
libgconf-2-4 \
|
|
||||||
libxss1 \
|
|
||||||
libxtst6 \
|
|
||||||
python \
|
|
||||||
g++ \
|
|
||||||
build-essential \
|
|
||||||
chromium \
|
chromium \
|
||||||
chromium-sandbox \
|
chromium-sandbox \
|
||||||
dumb-init \
|
dumb-init \
|
||||||
fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
&& rm -rf /src/*.deb
|
&& rm -rf /src/*.deb
|
||||||
|
|
||||||
# To run Headful mode, you will need to have a display, which is not present in a server.
|
# 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.
|
# 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.
|
# 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
|
# Install app dependencies
|
||||||
COPY package*.json ./
|
COPY package*.json ./
|
||||||
|
|
||||||
COPY .env .env
|
|
||||||
|
|
||||||
RUN yarn install --frozen-lockfile --production && yarn cache clean
|
RUN yarn install --frozen-lockfile --production && yarn cache clean
|
||||||
|
|
||||||
COPY --from=builder /usr/src/app/dist ./dist
|
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
|
# 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 \
|
&& groupadd -r pptruser && useradd -rm -g pptruser -G audio,video pptruser \
|
||||||
&& chown -R pptruser:pptruser /home/pptruser
|
&& chown -R pptruser:pptruser /home/pptruser
|
||||||
USER pptruser
|
|
||||||
|
|
||||||
|
RUN mkdir /storage && \
|
||||||
|
chown -R pptruser:pptruser /storage
|
||||||
|
USER pptruser
|
||||||
VOLUME /storage
|
VOLUME /storage
|
||||||
|
|
||||||
ENV DATA_PATH="/storage"
|
ENV DATA_PATH="/storage"
|
||||||
|
|
|
@ -50,7 +50,8 @@ MATRIX_ACCESS_TOKEN=
|
||||||
MATRIX_BOT_PASSWORD=
|
MATRIX_BOT_PASSWORD=
|
||||||
|
|
||||||
# Matrix Configurable Settings Defaults (optional)
|
# 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_DEFAULT_PREFIX_REPLY=false
|
||||||
|
|
||||||
# Matrix Feature Flags (optional)
|
# 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 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
|
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