Link and Leafcutter Dockerfiles
This commit is contained in:
parent
6dc4cfd3cc
commit
4e4603bd71
5 changed files with 42 additions and 28 deletions
|
|
@ -1,38 +1,51 @@
|
|||
FROM node:20-bullseye-slim as builder
|
||||
LABEL maintainer="Darren Clarke <darren@redaranj.com>"
|
||||
|
||||
FROM node:20 AS base
|
||||
|
||||
FROM base AS builder
|
||||
ARG APP_DIR=/opt/leafcutter
|
||||
RUN mkdir -p ${APP_DIR}/
|
||||
COPY . ${APP_DIR}/
|
||||
RUN chown -R node ${APP_DIR}/
|
||||
USER node
|
||||
RUN npm i -g turbo
|
||||
WORKDIR ${APP_DIR}
|
||||
ENV NEXT_PUBLIC_NEXTAUTH_URL https://lc.digiresilience.org
|
||||
RUN npm install
|
||||
RUN npm run build
|
||||
COPY . .
|
||||
RUN turbo prune --scope=leafcutter --docker
|
||||
|
||||
FROM node:20-bullseye-slim
|
||||
FROM base AS installer
|
||||
ARG APP_DIR=/opt/leafcutter
|
||||
WORKDIR ${APP_DIR}
|
||||
COPY .gitignore .gitignore
|
||||
COPY --from=builder ${APP_DIR}/out/json/ .
|
||||
COPY --from=builder ${APP_DIR}/out/package-lock.json ./package-lock.json
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
COPY --from=builder ${APP_DIR}/out/full/ .
|
||||
RUN npm i -g turbo
|
||||
RUN turbo run build --filter=leafcutter
|
||||
|
||||
FROM base AS runner
|
||||
ARG APP_DIR=/opt/leafcutter
|
||||
WORKDIR ${APP_DIR}/
|
||||
ARG BUILD_DATE
|
||||
ARG VERSION
|
||||
LABEL maintainer="Darren Clarke <darren@redaranj.com>"
|
||||
LABEL org.label-schema.build-date=$BUILD_DATE
|
||||
LABEL org.label-schema.version=$VERSION
|
||||
ARG APP_DIR=/opt/leafcutter
|
||||
ENV APP_DIR ${APP_DIR}
|
||||
|
||||
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
|
||||
apt-get install -y --no-install-recommends \
|
||||
dumb-init
|
||||
RUN mkdir -p ${APP_DIR}
|
||||
RUN chown -R node ${APP_DIR}/
|
||||
COPY docker-entrypoint.sh /docker-entrypoint.sh
|
||||
RUN chmod +x /docker-entrypoint.sh
|
||||
|
||||
USER node
|
||||
WORKDIR ${APP_DIR}
|
||||
COPY --from=builder ${APP_DIR}/node_modules ./node_modules
|
||||
COPY --from=builder ${APP_DIR}/.next ./.next
|
||||
COPY --from=builder ${APP_DIR}/next.config.js ./next.config.js
|
||||
COPY --from=installer ${APP_DIR}/node_modules/ ./node_modules/
|
||||
COPY --from=installer ${APP_DIR}/apps/leafcutter/ ./apps/leafcutter/
|
||||
COPY --from=installer ${APP_DIR}/package.json ./package.json
|
||||
USER root
|
||||
WORKDIR ${APP_DIR}/apps/leafcutter/
|
||||
RUN chmod +x docker-entrypoint.sh
|
||||
USER node
|
||||
EXPOSE 3000
|
||||
ENV PORT 3000
|
||||
ENV NODE_ENV production
|
||||
COPY package.json ./
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
ENTRYPOINT ["/opt/leafcutter/apps/leafcutter/docker-entrypoint.sh"]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cd ${APP_DIR}
|
||||
echo "starting admin app"
|
||||
echo "starting leafcutter"
|
||||
exec dumb-init npm run start
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ WORKDIR ${APP_DIR}
|
|||
COPY .gitignore .gitignore
|
||||
COPY --from=builder ${APP_DIR}/out/json/ .
|
||||
COPY --from=builder ${APP_DIR}/out/package-lock.json ./package-lock.json
|
||||
RUN npm install
|
||||
RUN npm ci --omit=dev
|
||||
|
||||
COPY --from=builder ${APP_DIR}/out/full/ .
|
||||
RUN npm i -g turbo
|
||||
|
|
@ -40,10 +40,12 @@ USER node
|
|||
WORKDIR ${APP_DIR}
|
||||
COPY --from=installer ${APP_DIR}/node_modules/ ./node_modules/
|
||||
COPY --from=installer ${APP_DIR}/apps/link/ ./apps/link/
|
||||
COPY --from=installer ${APP_DIR}/package.json ./package.json
|
||||
USER root
|
||||
RUN chmod +x ./apps/link/docker-entrypoint.sh
|
||||
WORKDIR ${APP_DIR}/apps/link/
|
||||
RUN chmod +x docker-entrypoint.sh
|
||||
USER node
|
||||
EXPOSE 3000
|
||||
ENV PORT 3000
|
||||
ENV NODE_ENV production
|
||||
ENTRYPOINT ["./apps/link/docker-entrypoint.sh"]
|
||||
ENTRYPOINT ["/opt/link/apps/link/docker-entrypoint.sh"]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
cd ${APP_DIR}
|
||||
echo "starting link"
|
||||
exec dumb-init npm run start
|
||||
|
||||
|
|
|
|||
|
|
@ -237,13 +237,15 @@ services:
|
|||
|
||||
leafcutter:
|
||||
container_name: leafcutter
|
||||
build: ./apps/leafcutter
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./apps/leafcutter/Dockerfile
|
||||
expose:
|
||||
- "3000"
|
||||
ports:
|
||||
- "8004:3000"
|
||||
environment:
|
||||
ZAMMAD_PROXY_URL: ${ZAMMAD_PROXY_URL}
|
||||
LINK_EMBEDDED: "true"
|
||||
|
||||
volumes:
|
||||
elasticsearch-data:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue