๐Ÿ“ฆ juspay / hyperswitch-web

๐Ÿ“„ Dockerfile.helm ยท 35 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35# Stage 1: Build the assets
FROM node:lts AS builder

# Set the build environment as an argument
ARG sdkEnv=sandbox
ARG sdkVersion=main
RUN if [ "$sdkVersion" != "main" ]; then gitBranch="v$sdkVersion"; else gitBranch="$sdkVersion"; fi && \
    git clone --branch ${gitBranch} https://github.com/juspay/hyperswitch-web --depth 1 /app

# Set the working directory to the cloned repository
WORKDIR /app

ENV ENV_BACKEND_URL=https://beta.hyperswitch.io/api
# Install dependencies and build the project
RUN npm_config_ignore_scripts=true npm install
RUN git submodule update --init --recursive
RUN npm run re:build
RUN npm run build:sandbox
# Stage 2: Serve the built assets
FROM nginx:alpine

# Set working directory and copy the built assets from the builder stage
WORKDIR /usr/share/nginx/html
ARG sdkVersion
ARG port=80 
ARG nginxPath=/usr/share/nginx/html/web/$sdkVersion
COPY --from=builder /app/dist/sandbox $nginxPath
WORKDIR $nginxPath/v1

# Add the embedded entrypoint script
COPY docker_helm_utils/change_urls.sh /docker-entrypoint.d/change_urls.sh
RUN chmod +x /docker-entrypoint.d/change_urls.sh

# Use the embedded entrypoint script and run Nginx
CMD ["nginx", "-g", "daemon off;"]