Running on docker throws import errors
Unanswered
Cinnamon posted this in #help-forum
CinnamonOP
I am trying to run my app in development on Docker, but I get
If I run it locally, it works.
Dockerfile
./src/app/globals.css
Module parse failed: Unexpected character '@' (1:0)
> @tailwind base;
| @tailwind components;
| @tailwind utilities;If I run it locally, it works.
Dockerfile
FROM node:20-alpine AS base
# Install dependencies only when needed
FROM base AS deps
# 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 git
WORKDIR /app
RUN mkdir .yarncache
# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* ./
RUN yarn --frozen-lockfile --skip-integrity-check --cache-folder ./.yarncache;
RUN rm -rf .yarncache
FROM base AS dev
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN yarn build
# Production image, copy all the files and run next
FROM base AS runner
WORKDIR /app
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
# Automatically leverage output traces to reduce image size
# https://nextjs.org/docs/advanced-features/output-file-tracing
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
CMD ["node", "server.js"]1 Reply
CinnamonOP
version: "3.8"
services:
db:
container_name: Price-Label-Builder-DB
image: mariadb:11.0
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
networks:
- intern
volumes:
- db-data:/var/lib/mysql
frontend:
depends_on:
- db
container_name: Proce-Label-Builder
build:
context: .
target: dev
command: yarn run dev
restart: unless-stopped
env_file:
- .env
environment:
- NODE_ENV=production
ports:
- 3000:3000
networks:
- intern
volumes:
- .:/app
- /app/node_modules
networks:
intern:
volumes:
db-data: