The image loads fine when running the aplication in my machine, but not when running with Docker. What am I doing wrong?
The Image is a image from Bing:
https://www.bing.com/th?id=OHR.FireWave_PT-BR3949258525_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp
Here is the Network tab error:
Request URL: http://localhost:3000/_next/image?url=https%3A%2F%2Fwww.bing.com%2Fth%3Fid%3DOHR.FireWave_PT-BR3949258525_1920x1080.jpg%26rf%3DLaDigue_1920x1080.jpg%26pid%3Dhp&w=1920&q=75
Request Method:GET
Status Code:400 Bad Request
Remote Address:[::1]:3000
Referrer Policy:strict-origin-when-cross-origin
This is my docker-compose.yml:
version: "3.8"
services:
app:
build:
context: .
dockerfile: Dockerfile
ports:
- "3000:3000"
environment:
NODE_ENV: production
OPENCAGE_API_KEY: ${OPENCAGE_API_KEY}
OPENWEATHERMAP_API_KEY: ${OPENWEATHERMAP_API_KEY}
And here is my Dockerfile:
FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
FROM node:18-alpine AS runner
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/.next ./.next
COPY --from=builder /app/package.json ./package.json
ENV NODE_ENV=production
ENV OPENCAGE_API_KEY=${OPENCAGE_API_KEY}
ENV OPENWEATHERMAP_API_KEY=${OPENWEATHERMAP_API_KEY}
EXPOSE 3000
CMD ["npm", "start"]
I feel like the error is in the ports, like it needs something to access bing address. Just don’t know what that might be.