Thailan
Thailan
PPrisma
Created by Thailan on 12/16/2024 in #help-and-questions
node:20-alpine OpenSsl deployment issue
Hi all! I have been having the openssl issue with my node:20-alpine Dockerfile. Here is the Dockerfile:
FROM node:20-alpine AS builder
# ENV TURBO_TEAM=
# ENV TURBO_TOKEN=
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
RUN apk update
# Set working directory
WORKDIR /app
RUN yarn global add turbo
COPY . .
RUN mv ._env .env
RUN mv ._gitignore .gitignore
RUN turbo prune --scope=api --docker

# Add lockfile and package.json's of isolated subworkspace
FROM node:20-alpine AS installer
RUN apk add --no-cache libc6-compat
RUN apk update
RUN apk add --update python3 make gcc postgresql-dev g++ && rm -rf /var/cache/apk/*
WORKDIR /app

# First install dependencies (as they change less often)
COPY ._gitignore .gitignore
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/yarn.lock ./yarn.lock
RUN yarn install

# Build the project and its dependencies
COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json
COPY ._env .env

RUN cd packages/database && npx prisma generate

# Uncomment and use build args to enable remote caching
# ARG TURBO_TEAM
# ENV TURBO_TEAM=$TURBO_TEAM

# ARG TURBO_TOKEN
# ENV TURBO_TOKEN=$TURBO_TOKEN

RUN npm i typescript -g
RUN npm i tsup -g
RUN yarn turbo run build --filter=api...

FROM node:20-alpine AS runner
WORKDIR /app

# Don't run production as root
RUN apk update && apk add bash

# Installing chrome for puppeteer
RUN apk add --no-cache chromium --repository=http://dl-cdn.alpinelinux.org/alpine/v3.10/main

RUN addgroup --system --gid 1001 expressjs
RUN adduser --system --uid 1001 expressjs
USER expressjs
COPY --from=installer /app .


CMD SERVER_PORT=8080 node apps/api/dist/index.js
FROM node:20-alpine AS builder
# ENV TURBO_TEAM=
# ENV TURBO_TOKEN=
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
RUN apk add --no-cache libc6-compat
RUN apk update
# Set working directory
WORKDIR /app
RUN yarn global add turbo
COPY . .
RUN mv ._env .env
RUN mv ._gitignore .gitignore
RUN turbo prune --scope=api --docker

# Add lockfile and package.json's of isolated subworkspace
FROM node:20-alpine AS installer
RUN apk add --no-cache libc6-compat
RUN apk update
RUN apk add --update python3 make gcc postgresql-dev g++ && rm -rf /var/cache/apk/*
WORKDIR /app

# First install dependencies (as they change less often)
COPY ._gitignore .gitignore
COPY --from=builder /app/out/json/ .
COPY --from=builder /app/out/yarn.lock ./yarn.lock
RUN yarn install

# Build the project and its dependencies
COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json
COPY ._env .env

RUN cd packages/database && npx prisma generate

# Uncomment and use build args to enable remote caching
# ARG TURBO_TEAM
# ENV TURBO_TEAM=$TURBO_TEAM

# ARG TURBO_TOKEN
# ENV TURBO_TOKEN=$TURBO_TOKEN

RUN npm i typescript -g
RUN npm i tsup -g
RUN yarn turbo run build --filter=api...

FROM node:20-alpine AS runner
WORKDIR /app

# Don't run production as root
RUN apk update && apk add bash

# Installing chrome for puppeteer
RUN apk add --no-cache chromium --repository=http://dl-cdn.alpinelinux.org/alpine/v3.10/main

RUN addgroup --system --gid 1001 expressjs
RUN adduser --system --uid 1001 expressjs
USER expressjs
COPY --from=installer /app .


CMD SERVER_PORT=8080 node apps/api/dist/index.js
5 replies