diff --git a/package.json b/package.json index a19f537..cd5fa19 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "web-wallet", - "version": "0.1.7-zenith-0.2.0", + "version": "0.1.7-zenith-0.2.1", "private": true, "dependencies": { "@laconic-network/cosmjs-util": "^0.1.0", diff --git a/stack/stack-orchestrator/config/app/run.sh b/stack/stack-orchestrator/config/app/run.sh index 1f7589b..ebfa2bb 100755 --- a/stack/stack-orchestrator/config/app/run.sh +++ b/stack/stack-orchestrator/config/app/run.sh @@ -18,7 +18,7 @@ export REACT_APP_GAS_ADJUSTMENT=$CERC_GAS_ADJUSTMENT export REACT_APP_ALLOWED_URLS=$CERC_ALLOWED_URLS # Set env variables in build -yarn set-env +import-meta-env -x /app/.env.example -p /app/build/index.html # Define the directory and file path FILE_PATH="/app/build/.well-known/walletconnect.txt" diff --git a/stack/stack-orchestrator/container-build/cerc-zenith-wallet-web/Dockerfile b/stack/stack-orchestrator/container-build/cerc-zenith-wallet-web/Dockerfile index 7e2f167..c841ad4 100644 --- a/stack/stack-orchestrator/container-build/cerc-zenith-wallet-web/Dockerfile +++ b/stack/stack-orchestrator/container-build/cerc-zenith-wallet-web/Dockerfile @@ -1,7 +1,9 @@ # Originally from: https://github.com/devcontainers/images/blob/main/src/javascript-node/.devcontainer/Dockerfile # [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster ARG VARIANT=22-bullseye -FROM node:${VARIANT} + +# Build stage +FROM node:${VARIANT} AS builder ARG USERNAME=node ARG NPM_GLOBAL=/usr/local/share/npm-global @@ -26,18 +28,30 @@ RUN \ && su ${USERNAME} -c "umask 0002 && npm install -g eslint" \ && npm cache clean --force > /dev/null 2>&1 -# Install additional OS packages. -RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ - && apt-get -y install --no-install-recommends jq bash netcat - -RUN mkdir -p /scripts - -# Install simple web server for now (use nginx perhaps later) -RUN yarn global add serve - WORKDIR /app COPY . . RUN yarn install && yarn build +# Production stage +FROM node:${VARIANT}-slim AS production + +# Install additional OS packages for debugging +RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y install --no-install-recommends bash netcat \ + && rm -rf /var/lib/apt/lists/* + +RUN mkdir -p /scripts + +# Install serve package globally +# Install import-meta-env for setting environment variables (check package.json for version) +RUN yarn global add serve@^14.2.4 @import-meta-env/cli@^0.7.3 + +# Create app directory +WORKDIR /app + +# Copy built application and env example from builder stage +COPY --from=builder /app/build ./build +COPY --from=builder /app/.env.example ./.env.example + # Expose port for http EXPOSE 80