This commit is contained in:
Morten Olsen
2024-01-11 09:03:14 +01:00
commit 0ac0c918fa
81 changed files with 6979 additions and 0 deletions

42
docker/Dockerfile Normal file
View File

@@ -0,0 +1,42 @@
FROM node:18-alpine AS base
RUN corepack enable
FROM base AS builder
RUN apk add --no-cache libc6-compat
RUN apk update
RUN npm install -g turbo
# Set working directory
WORKDIR /app
COPY . .
RUN turbo prune @morten-olsen/mini-loader-server --docker
# Add lockfile and package.json's of isolated subworkspace
FROM base AS installer
RUN apk add --no-cache libc6-compat
RUN apk update
WORKDIR /app
# First install the dependencies (as they change less often)
COPY .gitignore .gitignore
COPY --from=builder /app/out/json/ .
RUN pnpm install
# Build the project
COPY --from=builder /app/out/full/ .
RUN pnpm turbo run build --filter=@morten-olsen/mini-loader-server
FROM base AS runner
WORKDIR /app
# Don't run production as root
RUN \
ln -s /app/packages/server/bin/index.mjs /usr/local/bin/mini-loader-server
COPY ./docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY --from=installer /app .
EXPOSE 4500
ENTRYPOINT ["/entrypoint.sh"]
CMD ["mini-loader-server"]