🐛 Fixing dockerfile with chromium at run
This commit is contained in:
parent
1f41890740
commit
c189681f3f
40
Dockerfile
40
Dockerfile
@ -1,19 +1,12 @@
|
||||
# Install dependencies only when needed
|
||||
FROM node:18-bullseye-slim AS deps
|
||||
FROM node:19-alpine AS deps
|
||||
|
||||
WORKDIR leCoffre
|
||||
|
||||
RUN npm install -D prisma@4.11.0
|
||||
COPY package.json ./
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y wget gnupg \
|
||||
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor -o /usr/share/keyrings/googlechrome-linux-keyring.gpg \
|
||||
&& sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/googlechrome-linux-keyring.gpg] 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 chromium fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-khmeros fonts-kacst fonts-freefont-ttf libxss1 openssh-client git \
|
||||
--no-install-recommends \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN apk update && apk add openssh-client git
|
||||
|
||||
COPY id_rsa /root/.ssh/id_rsa
|
||||
RUN chmod 600 ~/.ssh/id_rsa
|
||||
@ -22,14 +15,6 @@ RUN ssh-keyscan github.com smart-chain-fr/leCoffre-resources.git >> /root/.ssh/k
|
||||
|
||||
RUN npm install --frozen-lockfile
|
||||
|
||||
# Rebuild the source code only when needed
|
||||
FROM node:18-bullseye-slim AS builder
|
||||
|
||||
WORKDIR leCoffre
|
||||
|
||||
COPY --from=deps leCoffre/node_modules ./node_modules
|
||||
COPY --from=deps leCoffre/package.json package.json
|
||||
|
||||
COPY tsconfig.json tsconfig.json
|
||||
COPY src src
|
||||
|
||||
@ -37,24 +22,19 @@ RUN npx prisma generate
|
||||
RUN npm run build
|
||||
|
||||
# Production image, copy all the files and run next
|
||||
FROM node:18-bullseye-slim AS production
|
||||
FROM node:19-alpine AS production
|
||||
|
||||
WORKDIR leCoffre
|
||||
|
||||
RUN adduser --disabled-password lecoffreuser --uid 10000 && chown -R lecoffreuser .
|
||||
RUN adduser -D lecoffreuser --uid 10000 && chown -R lecoffreuser .
|
||||
|
||||
RUN mkdir -p /home/lecoffreuser/Downloads \
|
||||
&& mkdir -p /home/lecoffreuser/Downloads \
|
||||
&& chown -R lecoffreuser:lecoffreuser /home/lecoffreuser
|
||||
|
||||
COPY --from=builder --chown=lecoffreuser leCoffre/node_modules ./node_modules
|
||||
COPY --from=builder --chown=lecoffreuser leCoffre/dist dist
|
||||
COPY --from=builder --chown=lecoffreuser leCoffre/package.json ./package.json
|
||||
COPY --from=builder --chown=lecoffreuser leCoffre/src/common/databases ./src/common/databases
|
||||
COPY --from=deps --chown=lecoffreuser leCoffre/node_modules ./node_modules
|
||||
COPY --from=deps --chown=lecoffreuser leCoffre/dist dist
|
||||
COPY --from=deps --chown=lecoffreuser leCoffre/package.json ./package.json
|
||||
COPY --from=deps --chown=lecoffreuser leCoffre/src/common/databases ./src/common/databases
|
||||
|
||||
RUN apk update && apk add chromium
|
||||
USER lecoffreuser
|
||||
|
||||
CMD ["npm", "run", "start"]
|
||||
EXPOSE 3001
|
||||
|
||||
|
||||
EXPOSE 3001
|
Loading…
x
Reference in New Issue
Block a user