-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(pay): change env variable pattern
- Loading branch information
1 parent
3fea78e
commit c539c99
Showing
15 changed files
with
109 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,32 @@ | ||
# Install dependencies only when needed | ||
FROM node:20-alpine 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 python3 make g++ | ||
WORKDIR /app | ||
COPY package.json yarn.lock ./ | ||
RUN yarn global add node-gyp \ | ||
&& yarn install --frozen-lockfile | ||
|
||
# Rebuild the source code only when needed | ||
FROM node:20-alpine AS builder | ||
WORKDIR /app | ||
COPY . . | ||
COPY --from=deps /app/node_modules ./node_modules | ||
RUN yarn build && yarn install --production --ignore-scripts --prefer-offline | ||
|
||
# Production image, copy all the files and run next | ||
FROM node:20-alpine AS runner | ||
WORKDIR /app | ||
|
||
ENV NODE_ENV production | ||
|
||
RUN addgroup -g 1001 -S nodejs | ||
RUN adduser -S nextjs -u 1001 | ||
|
||
# You only need to copy next.config.js if you are NOT using the default configuration | ||
# COPY --from=builder /app/next.config.js ./ | ||
COPY --from=builder /app/public ./public | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next ./.next | ||
COPY --from=builder /app/node_modules ./node_modules | ||
COPY --from=builder /app/package.json ./package.json | ||
|
||
USER nextjs | ||
|
||
EXPOSE 3000 | ||
|
||
ARG BUILDTIME | ||
FROM nixos/nix:latest AS builder | ||
ARG APP=pay | ||
|
||
COPY . /workdir | ||
WORKDIR /workdir | ||
|
||
RUN set -eux; \ | ||
nix \ | ||
--extra-experimental-features "nix-command flakes impure-derivations ca-derivations" \ | ||
--option filter-syscalls false \ | ||
build \ | ||
".#$APP"; | ||
|
||
RUN mkdir -p /tmp/nix-store-closure /tmp/local-bin | ||
RUN cp -R $(nix-store --query --requisites result/) /tmp/nix-store-closure | ||
RUN ln -snf $(nix-store --query result/)/bin/* /tmp/local-bin/ | ||
|
||
FROM gcr.io/distroless/static-debian11 AS final | ||
ARG APP=pay | ||
|
||
WORKDIR /app/$APP | ||
COPY --from=builder /tmp/nix-store-closure /nix/store | ||
COPY --from=builder /tmp/local-bin/* /usr/local/bin/ | ||
|
||
USER 1000 | ||
|
||
ARG COMMITHASH | ||
ENV BUILDTIME ${BUILDTIME} | ||
ENV COMMITHASH ${COMMITHASH} | ||
|
||
CMD ["node_modules/.bin/next", "start"] | ||
CMD [ \ | ||
"/usr/local/bin/run" \ | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
export const USD_INVOICE_EXPIRE_INTERVAL = 60 * 5 | ||
export const MAX_INPUT_VALUE_LENGTH = 14 | ||
export const CASH_REGISTER_DESCRIPTION = "Blink POS Cash Register" | ||
export const APP_DESCRIPTION = "Blink official lightning network node" | ||
export const URL_HOST_DOMAIN = "blink.sv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { createEnv } from "@t3-oss/env-nextjs" | ||
import { z } from "zod" | ||
|
||
export const env = createEnv({ | ||
server: { | ||
CORE_GQL_URL_INTRANET: z.string(), // Use intranet URL to preserve tracing headers | ||
PAY_URL: z.string(), | ||
NOSTR_PUBKEY: z.string().optional(), | ||
REDIS_PASSWORD: z.string().optional(), | ||
REDIS_MASTER_NAME: z.string().optional(), | ||
REDIS_0_DNS: z.string().optional(), | ||
REDIS_1_DNS: z.string().optional(), | ||
REDIS_2_DNS: z.string().optional(), | ||
}, | ||
client: { | ||
NEXT_PUBLIC_CORE_GQL_URL: z.string(), | ||
NEXT_PUBLIC_CORE_GQL_WEB_SOCKET_URL: z.string(), | ||
NEXT_PUBLIC_PAY_DOMAIN: z.string(), | ||
}, | ||
runtimeEnv: { | ||
CORE_GQL_URL_INTRANET: process.env.CORE_GQL_URL_INTRANET, | ||
NEXT_PUBLIC_CORE_GQL_URL: process.env.NEXT_PUBLIC_CORE_GQL_URL, | ||
NEXT_PUBLIC_CORE_GQL_WEB_SOCKET_URL: process.env.NEXT_PUBLIC_CORE_GQL_WEB_SOCKET_URL, | ||
PAY_URL: process.env.PAY_URL, | ||
NEXT_PUBLIC_PAY_DOMAIN: process.env.NEXT_PUBLIC_PAY_DOMAIN, | ||
NOSTR_PUBKEY: process.env.NOSTR_PUBKEY, // Optional but required for Nostr Zaps | ||
REDIS_PASSWORD: process.env.REDIS_PASSWORD, // Optional but required for Nostr Zaps | ||
REDIS_MASTER_NAME: process.env.REDIS_MASTER_NAME, // Optional but required for Nostr Zaps | ||
REDIS_0_DNS: process.env.REDIS_0_DNS, // Optional but required for Nostr Zaps | ||
REDIS_1_DNS: process.env.REDIS_1_DNS, // Optional but required for Nostr Zaps | ||
REDIS_2_DNS: process.env.REDIS_2_DNS, // Optional but required for Nostr Zaps | ||
}, | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.