generated from Mirasaki/discord.js-bot-template
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add arm64 Dockerfile to devcontainer
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
FROM arm64v8/node:20-slim | ||
|
||
# Please refer to https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-puppeteer-in-docker | ||
# for more information on running puppeteer in docker | ||
|
||
# Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others) | ||
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer | ||
# installs, work. | ||
RUN apt-get update \ | ||
&& apt-get install -y wget gnupg \ | ||
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ | ||
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ | ||
&& apt-get update \ | ||
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 \ | ||
--no-install-recommends \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# If running Docker >= 1.13.0 use docker run's --init arg to reap zombie processes, otherwise | ||
# uncomment the following lines to have `dumb-init` as PID 1 | ||
# ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_x86_64 /usr/local/bin/dumb-init | ||
# RUN chmod +x /usr/local/bin/dumb-init | ||
# ENTRYPOINT ["dumb-init", "--"] | ||
|
||
# Uncomment to skip the chromium download when installing puppeteer. If you do, | ||
# you'll need to launch puppeteer with: | ||
# browser.launch({executablePath: 'google-chrome-stable'}) | ||
# ENV PUPPETEER_SKIP_DOWNLOAD true | ||
|
||
# Create app/working/bot directory | ||
RUN mkdir -p /app | ||
WORKDIR /app | ||
|
||
# Install app production dependencies | ||
# A wildcard is used to ensure both package.json AND package-lock.json are copied | ||
# where available (npm@5+) | ||
COPY package*.json ./ | ||
RUN npm ci --omit=dev | ||
|
||
# Install puppeteer so it's available in the container. | ||
# Add user so we don't need --no-sandbox. | ||
# same layer as npm install to keep re-chowned files from using up several hundred MBs more space | ||
RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \ | ||
&& mkdir -p /home/pptruser/Downloads \ | ||
&& chown -R pptruser:pptruser /home/pptruser \ | ||
&& chown -R pptruser:pptruser /app/node_modules \ | ||
&& chown -R pptruser:pptruser /app/package.json \ | ||
&& chown -R pptruser:pptruser /app/package-lock.json | ||
|
||
# Run everything after as non-privileged user. | ||
USER pptruser | ||
|
||
# Bundle app source | ||
COPY . ./ | ||
|
||
# Optional API/Backend port | ||
EXPOSE 3000 | ||
|
||
# Run the start command | ||
CMD [ "npm", "run", "start" ] |