amir
amir
TTCTheo's Typesafe Cult
Created by amir on 1/13/2025 in #questions
Question about ARGs/Envs in dockerfile suggested in T3 website.
I am not a docker veteran however on this page the example seems a bit wrong. so on this block
##### 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 . .
##### 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 . .
ARG DATABASE_URL is not gonna be used on the build step isn't it? and it is not provided also with the build command. so it might be not needed here? and the next line ARG NEXT_PUBLIC_CLIENTVAR gets the ARG but never actually puts it into ENV so the build can have it. shoudn't we add a line here like: ENV NEXT_PUBLIC_CLIENTVAR=$NEXT_PUBLIC_CLIENTVAR ? Would be nice if someone with more experience with Docker can take a look at this and let me know if my suspissions are right?
6 replies