Hey fellow developers,
I have decided to move from AWS to Azure and am very new in this new devOps environment.The way i want to setup my pipeline is as follows:
- I want to push my container web app (next.js) with github actions to ACR.
- Then the app services should automatically notice that a new image is in the ACR and update the web app with the new image for a nice CD/CI flow.
I can run the image locally without any problems the issue it when it is being run on the cloud (app service) it crashes after it pulls the image from ECR as seen in the deployment logs from the image below:
I tried finding more informative logs, but dont know where to look.
I have setup my enviornmental varibles in the app services.
This is my dockerfile:
DEPENDENCIES
FROM --platform=linux/amd64 node:20-alpine AS deps
RUN apk add --no-cache libc6-compat openssl
WORKDIR /app
Install Prisma Client - remove if not using Prisma
COPY prisma ./
Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
RUN
if [ -f yarn.lock ]; then yarn --frozen-lockfile;
elif [ -f package-lock.json ]; then npm ci;
elif [ -f pnpm-lock.yaml ]; then yarn global add pnpm && pnpm i;
else echo "Lockfile not found." && exit 1;
fi
BUILDER
FROM --platform=linux/amd64 node:20-alpine AS builder
ARG DATABASE_URL
ARG NEXT_PUBLIC_CLIENTVAR
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN npm run build
RUNNER
Use a minimal Node.js image with necessary libraries
FROM node:20-alpine AS runner
WORKDIR /app
RUN apk add --no-cache musl libc6-compat openssl
ENV NODE_ENV production
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
Set the correct permission for prerender cache
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
EXPOSE 3000
ENV PORT 3000
CMD ["node", "server.js"]
Thanks for the help in advance!!