Update dockerfile

This commit is contained in:
Essem 2022-06-17 19:44:29 -05:00
parent fbfc1bae85
commit 598c29ab17
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
5 changed files with 22 additions and 79 deletions

View file

@ -4,8 +4,12 @@ FROM node:alpine
RUN apk --no-cache upgrade
RUN apk add --no-cache git cmake msttcorefonts-installer python3 alpine-sdk ffmpeg wget rpm2cpio \
zlib-dev libpng-dev libjpeg-turbo-dev freetype-dev fontconfig-dev \
libtool libwebp-dev libxml2-dev pango-dev freetype fontconfig \
vips vips-dev grep
libtool libwebp-dev libxml2-dev freetype fontconfig \
vips vips-dev grep libc6-compat
# install pnpm
RUN --mount=type=cache,id=pnpm-store,target=/root/.pnpm-store \
npm install -g pnpm@6.27.1
# gets latest version of twemoji
RUN mkdir /tmp/twemoji \
@ -25,7 +29,7 @@ RUN git clone https://github.com/carlobaldassi/liblqr \
&& make install
# install imagemagick from source rather than using the package
# since the alpine package does not include pango support.
# since the alpine package does not include liblqr support.
RUN git clone https://github.com/ImageMagick/ImageMagick.git ImageMagick \
&& cd ImageMagick \
&& ./configure \
@ -54,26 +58,27 @@ COPY ./assets/caption.otf /usr/share/fonts/caption.otf
COPY ./assets/caption2.ttf /usr/share/fonts/caption2.ttf
COPY ./assets/hbc.ttf /usr/share/fonts/hbc.ttf
COPY ./assets/reddit.ttf /usr/share/fonts/reddit.ttf
COPY ./assets/whisper.otf /usr/share/fonts/whisper.otf
RUN fc-cache -fv
COPY --chown=node:node ./package.json package.json
COPY --chown=node:node ./package-lock.json package-lock.json
RUN npm install
COPY --chown=node:node ./pnpm-lock.yaml pnpm-lock.yaml
RUN pnpm install
COPY . .
RUN rm .env
RUN npm run build
RUN pnpm run build
RUN mkdir /home/esmBot/help
RUN chown esmBot:esmBot /home/esmBot/help
RUN chmod 666 /home/esmBot/help
RUN mkdir /home/esmBot/help \
&& chown esmBot:esmBot /home/esmBot/help \
&& chmod 777 /home/esmBot/help
RUN mkdir /home/esmBot/temp
RUN chown esmBot:esmBot /home/esmBot/temp
RUN chmod 666 /home/esmBot/temp
RUN mkdir /home/esmBot/temp \
&& chown esmBot:esmBot /home/esmBot/temp \
&& chmod 777 /home/esmBot/temp
RUN mkdir /home/esmBot/.internal/logs
RUN chown esmBot:esmBot /home/esmBot/.internal/logs
RUN chmod 666 /home/esmBot/.internal/logs
RUN mkdir /home/esmBot/.internal/logs \
&& chown esmBot:esmBot /home/esmBot/.internal/logs \
&& chmod 777 /home/esmBot/.internal/logs
USER esmBot

View file

@ -1,60 +0,0 @@
# Docker/Kubernetes file for running the image API
FROM node:alpine
RUN apk --no-cache upgrade
RUN apk add --no-cache git cmake msttcorefonts-installer python3 alpine-sdk ffmpeg \
zlib-dev libpng-dev libjpeg-turbo-dev freetype-dev fontconfig-dev \
libtool libwebp-dev libxml2-dev pango-dev freetype fontconfig \
vips vips-dev
# liblqr needs to be built manually for magick to work
# and because alpine doesn't have it in their repos
RUN git clone https://github.com/carlobaldassi/liblqr \
&& cd liblqr \
&& ./configure \
&& make \
&& make install
# install imagemagick from source rather than using the package
# since the alpine package does not include pango support.
RUN git clone https://github.com/ImageMagick/ImageMagick.git ImageMagick \
&& cd ImageMagick \
&& ./configure \
--prefix=/usr \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--enable-static \
--disable-openmp \
--with-threads \
--with-png \
--with-webp \
--with-modules \
--with-pango \
--without-hdri \
--with-lqr \
&& make \
&& make install
RUN update-ms-fonts && fc-cache -f
RUN adduser esmBot -s /bin/sh -D
WORKDIR /home/esmBot/.internal
COPY ./assets/caption.otf /usr/share/fonts/caption.otf
COPY ./assets/caption2.ttf /usr/share/fonts/caption2.ttf
COPY ./assets/hbc.ttf /usr/share/fonts/hbc.ttf
COPY ./assets/reddit.ttf /usr/share/fonts/reddit.ttf
RUN fc-cache -fv
COPY --chown=node:node ./package.json package.json
COPY --chown=node:node ./package-lock.json package-lock.json
RUN npm install
COPY . .
RUN npm run build
USER esmBot
EXPOSE 3762
ENTRYPOINT ["node", "api/index.js"]

View file

@ -34,7 +34,7 @@ A client sends *requests* (T-messages) to a server, which subsequently *replies*
### Job Object
The job object is formatted like this:
```json
```js
{
"cmd": string, // name of internal image command, e.g. caption
"path": string, // canonical image URL, used for getting the actual image

View file

@ -4,7 +4,6 @@ services:
bot:
build:
context: .
dockerfile: Dockerfile.bot
image: esmbot
restart: unless-stopped
volumes:

View file

@ -10,8 +10,7 @@
},
"scripts": {
"build": "cmake-js compile",
"docker:build": "docker build -t esmbot -f Dockerfile.bot .",
"docker:build-api": "docker build -t esmbot-api -f Dockerfile.api .",
"docker:build": "DOCKER_BUILDKIT=1 docker build -t esmbot .",
"docker:run-bot": "docker run --rm --network=host esmbot",
"docker:run-api": "docker run --rm --network=host esmbot-api",
"docker:run-lava": "docker run --rm --network host -v \"$(pwd)\"/application.yml:/opt/Lavalink/application.yml -v \"$(pwd)\"/assets:/opt/Lavalink/assets fredboat/lavalink:dev",