Craig
Craig
RRailway
Created by Craig on 11/13/2023 in #✋|help
ENV vars not been passed on build?
@Brody simple fix after all I just needed to move ARG PAYLOAD_SECRET before FROM base as runtime
21 replies
RRailway
Created by Craig on 11/13/2023 in #✋|help
ENV vars not been passed on build?
Sorry just realised I didn't redo the file far enough, but I did use ARG PAYLOAD_SECRET=xxx already removed the .env was just a tempory thing to see if it built. WIll try removing the docker file and re adding it again.
21 replies
RRailway
Created by Craig on 11/13/2023 in #✋|help
ENV vars not been passed on build?
FROM node:18.8-alpine as base

FROM base as builder

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

COPY . .
RUN yarn install
RUN yarn build

FROM base as runtime

ENV NODE_ENV=production
ENV PAYLOAD_CONFIG_PATH=dist/payload.config.js

ENV DATABASE_URI=xxx
ENV NEXT_PRIVATE_DRAFT_SECRET=xxx
ENV NEXT_PRIVATE_REVALIDATION_KEY=xxx
ENV NEXT_PUBLIC_IS_LIVE=false
ENV NEXT_PUBLIC_SERVER_URL=https://xxx
ENV PAYLOAD_PUBLIC_DRAFT_SECRET=xxx
ENV PAYLOAD_PUBLIC_SERVER_URL=https://xxx
ENV PAYLOAD_SECRET=xxx
ENV PORT=3000
ENV REVALIDATION_KEY=xxx

WORKDIR /home/node/app
COPY package*.json ./
COPY yarn.lock ./

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

EXPOSE 3000

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

FROM base as builder

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

COPY . .
RUN yarn install
RUN yarn build

FROM base as runtime

ENV NODE_ENV=production
ENV PAYLOAD_CONFIG_PATH=dist/payload.config.js

ENV DATABASE_URI=xxx
ENV NEXT_PRIVATE_DRAFT_SECRET=xxx
ENV NEXT_PRIVATE_REVALIDATION_KEY=xxx
ENV NEXT_PUBLIC_IS_LIVE=false
ENV NEXT_PUBLIC_SERVER_URL=https://xxx
ENV PAYLOAD_PUBLIC_DRAFT_SECRET=xxx
ENV PAYLOAD_PUBLIC_SERVER_URL=https://xxx
ENV PAYLOAD_SECRET=xxx
ENV PORT=3000
ENV REVALIDATION_KEY=xxx

WORKDIR /home/node/app
COPY package*.json ./
COPY yarn.lock ./

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

EXPOSE 3000

CMD ["node", "dist/server.js"]
21 replies
RRailway
Created by Craig on 11/13/2023 in #✋|help
ENV vars not been passed on build?
Turns out adding them does nothing... pushing my .env file does fix the issue but this obviously isn't ideal.
21 replies
RRailway
Created by Craig on 11/13/2023 in #✋|help
ENV vars not been passed on build?
@Brody I don't reference any of the above variables in my docker file
FROM node:18.8-alpine as base

FROM base as builder

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

COPY . .
RUN yarn install
RUN yarn build

FROM base as runtime

ENV NODE_ENV=production
ENV PAYLOAD_CONFIG_PATH=dist/payload.config.js

WORKDIR /home/node/app
COPY package*.json ./
COPY yarn.lock ./

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

EXPOSE 3000

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

FROM base as builder

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

COPY . .
RUN yarn install
RUN yarn build

FROM base as runtime

ENV NODE_ENV=production
ENV PAYLOAD_CONFIG_PATH=dist/payload.config.js

WORKDIR /home/node/app
COPY package*.json ./
COPY yarn.lock ./

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

EXPOSE 3000

CMD ["node", "dist/server.js"]
21 replies
RRailway
Created by Craig on 11/13/2023 in #✋|help
ENV vars not been passed on build?
@Brody yeah
21 replies
RRailway
Created by Craig on 11/13/2023 in #✋|help
ENV vars not been passed on build?
No description
21 replies
RRailway
Created by Craig on 11/13/2023 in #✋|help
ENV vars not been passed on build?
1c0a43f8-b799-450b-a357-77fe5d973c74
21 replies