Thijs
Thijs
RRailway
Created by Thijs on 1/21/2024 in #✋|help
Environment variables not being injected in NodeJS app
I followed a different tutorial which is out of date, because it doesn't use ARG
15 replies
RRailway
Created by Thijs on 1/21/2024 in #✋|help
Environment variables not being injected in NodeJS app
Thanks! I'm getting somewhere now
15 replies
RRailway
Created by Thijs on 1/21/2024 in #✋|help
Environment variables not being injected in NodeJS app
?
15 replies
RRailway
Created by Thijs on 1/21/2024 in #✋|help
Environment variables not being injected in NodeJS app
So all env keys I need to pass to access through ARG.
ARG NODE_ENV

ENV NODE_ENV=$NODE_ENV
ARG NODE_ENV

ENV NODE_ENV=$NODE_ENV
15 replies
RRailway
Created by Thijs on 1/21/2024 in #✋|help
Environment variables not being injected in NodeJS app
Can you give me an example for NODE_ENV?
15 replies
RRailway
Created by Thijs on 1/21/2024 in #✋|help
Environment variables not being injected in NodeJS app
I use the default docker file
FROM node:18-alpine as base

FROM base as builder

WORKDIR /home/node
COPY package*.json ./

COPY . .
RUN yarn install
RUN yarn build

FROM base as runtime

ENV NODE_ENV=production

WORKDIR /home/node
COPY package*.json ./

RUN yarn install --production
COPY --from=builder /home/node/dist ./dist
COPY --from=builder /home/node/build ./build

EXPOSE 3000

CMD ["node", "dist/server.js"]
FROM node:18-alpine as base

FROM base as builder

WORKDIR /home/node
COPY package*.json ./

COPY . .
RUN yarn install
RUN yarn build

FROM base as runtime

ENV NODE_ENV=production

WORKDIR /home/node
COPY package*.json ./

RUN yarn install --production
COPY --from=builder /home/node/dist ./dist
COPY --from=builder /home/node/build ./build

EXPOSE 3000

CMD ["node", "dist/server.js"]
15 replies
RRailway
Created by Thijs on 1/21/2024 in #✋|help
Environment variables not being injected in NodeJS app
Yes
15 replies
RRailway
Created by Thijs on 1/21/2024 in #✋|help
Environment variables not being injected in NodeJS app
d426ba88-e4ae-4a98-8b5a-b473f6902b16
15 replies