-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from lalithkota/1.0
Repo and module renamed
- Loading branch information
Showing
11 changed files
with
109 additions
and
70 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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
NEXT_PUBLIC_BASE_PATH="/selfservice" | ||
NEXT_PUBLIC_BASE_API_PATH="/v1/selfservice" |
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,31 +1,48 @@ | ||
FROM node:18-alpine AS base | ||
|
||
RUN apk add bash | ||
|
||
FROM base AS builder | ||
# 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 | ||
|
||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
WORKDIR /app | ||
|
||
COPY package.json package-lock.json* ./ | ||
|
||
RUN npm ci | ||
|
||
COPY . . | ||
RUN ./docker-env-replace.sh .env.prod .env.local | ||
|
||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
RUN npm run build | ||
|
||
FROM base AS runner | ||
WORKDIR /app | ||
|
||
RUN chown -R nextjs:nodejs /app | ||
RUN addgroup --system --gid 1001 nodejs | ||
RUN adduser --system --uid 1001 nextjs | ||
|
||
USER nextjs | ||
RUN mkdir .next | ||
COPY --from=builder /app/public ./public | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./ | ||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static | ||
COPY --from=builder --chown=nextjs:nodejs /app/.env.prod . | ||
COPY --from=builder --chown=nextjs:nodejs /app/docker-entrypoint.sh . | ||
|
||
# Install dependencies based on the preferred package manager | ||
COPY --chown=nextjs:nodejs package.json package-lock.json* ./ | ||
RUN npm ci | ||
RUN npm i sharp | ||
|
||
RUN chown nextjs:nodejs /app | ||
|
||
COPY --chown=nextjs:nodejs . . | ||
USER nextjs | ||
|
||
# Next.js collects completely anonymous telemetry data about general usage. | ||
# Learn more here: https://nextjs.org/telemetry | ||
# Uncomment the following line in case you want to disable telemetry during the build. | ||
ENV NEXT_TELEMETRY_DISABLED=1 | ||
ENV NODE_ENV=production | ||
ENV HOSTNAME="0.0.0.0" | ||
ENV PORT=3000 | ||
ENV NEXT_TELEMETRY_DISABLED 1 | ||
ENV NODE_ENV production | ||
ENV PORT 3000 | ||
ENV HOSTNAME 0.0.0.0 | ||
|
||
EXPOSE 3000 | ||
|
||
CMD npm run build && npm run start | ||
ENTRYPOINT [ "./docker-entrypoint.sh" ] | ||
CMD node server.js |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,22 @@ | ||
# OpenG2P Beneficiary Portal | ||
|
||
OpenG2P beneficiary self service portal | ||
|
||
## Developer Notes | ||
|
||
- For local development. | ||
- Install Node, Npm, Npx. | ||
- Install dependencies | ||
```sh | ||
npm ci | ||
``` | ||
- Create a `.env.local` file with the following content. Edit the below API base path appropriately. | ||
```sh | ||
NEXT_PUBLIC_BASE_PATH="" | ||
NEXT_PUBLIC_BASE_API_PATH="http://localhost:8000/" | ||
``` | ||
- Run the following to start the app | ||
```sh | ||
npm run dev | ||
``` | ||
- Open [http://localhost:3000](http://localhost:3000) on browser. |
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,25 @@ | ||
#!/bin/bash | ||
|
||
WORKDIR="/app" | ||
ENV_FILE=$WORKDIR/.env.prod | ||
|
||
IFS=$'\n' next_env_vars=($(awk 'BEGIN{for(v in ENVIRON) print v}' | grep "^NEXT_PUBLIC_")) | ||
for env_var in ${next_env_vars[@]}; do | ||
file_env_var_line=$(grep "${env_var}=" $ENV_FILE) | ||
if ! [ -z $file_env_var_line ]; then | ||
sed -i "s|$file_env_var_line||g" $ENV_FILE | ||
fi | ||
done | ||
|
||
set -a | ||
source $ENV_FILE | ||
set +a | ||
|
||
IFS=$'\n' next_env_vars=($(awk 'BEGIN{for(v in ENVIRON) print v}' | grep "^NEXT_PUBLIC_")) | ||
for env_var in ${next_env_vars[@]}; do | ||
for file in $(find $WORKDIR -name "node_modules" -prune -o -type f -exec grep -l "/@$env_var@" {} \;); do | ||
sed -i "s|/@$env_var@|${!env_var}|g" $file | ||
done | ||
done | ||
|
||
exec "$@" |
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,15 @@ | ||
#!/bin/bash | ||
|
||
input_file=$1 | ||
output_file=$2 | ||
|
||
while read line; do | ||
# Skip empty lines and comments | ||
if [[ -z "$line" ]] || [[ "$line" =~ ^# ]]; then | ||
echo "$line" >> $output_file | ||
continue | ||
fi | ||
|
||
key=$(echo "$line" | cut -d'=' -f1) | ||
echo "$key=/@$key@" >> $output_file | ||
done < $input_file |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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