Skip to content

Commit

Permalink
fix: envs for boba sepolia docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
wsdt committed Aug 10, 2024
1 parent 0cf3d7f commit bc2eef2
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 50 deletions.
2 changes: 1 addition & 1 deletion contracts/script/deploy-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ async function main() {

// save relevant envs to frontend
console.log('Saving relevant env variables to frontend. The Boba sepolia config will be used if some variables are missing.')
const frontendEnvPath = '../../frontend/.env-sepolia'
const frontendEnvPath = '../../frontend/.env-boba-sepolia'
updateEnvVariable("VITE_SMART_CONTRACT", tokenPriceAddress, frontendEnvPath);
updateEnvVariable("VITE_SNAP_ORIGIN", 'npm:@bobanetwork/snap-account-abstraction-keyring-hc', frontendEnvPath);
updateEnvVariable("VITE_SNAP_VERSION", DEFAULT_SNAP_VERSION, frontendEnvPath);
Expand Down
6 changes: 4 additions & 2 deletions docker-compose.sepolia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ services:
build:
context: ./frontend
dockerfile: Dockerfile
args:
- NETWORK=boba-sepolia # boba-sepolia | local
image: bobanetwork/aa-hc-example-frontend
env_file:
- ./frontend/.env-sepolia
- frontend/.env-boba-sepolia
ports:
- "8081:80"
- "8000:80"
restart: unless-stopped

networks:
Expand Down
File renamed without changes.
9 changes: 6 additions & 3 deletions frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Stage 1: Build the application
FROM node:20-alpine AS build

ARG NETWORK

# Set working directory
WORKDIR /app

Expand All @@ -13,6 +15,10 @@ RUN npm i
# Copy the rest of the application code
COPY . .

# Copy the correct .env file based on the NETWORK argument
COPY .env-${NETWORK} .env
# VITE needs env-vars at build time

# Build the application
RUN npm run build

Expand All @@ -22,9 +28,6 @@ FROM nginx:alpine
# Copy the built assets from the build stage
COPY --from=build /app/dist /usr/share/nginx/html

# Copy a custom nginx configuration if needed
# COPY nginx.conf /etc/nginx/nginx.conf

# Expose port 80
EXPOSE 80

Expand Down
5 changes: 4 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"dev:sepolia": "cross-env-shell dotenv -e .env-boba-sepolia \"vite dev\"",
"dev:local": "cross-env-shell dotenv -e .env-local \"vite dev\"",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
Expand Down Expand Up @@ -36,6 +37,8 @@
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitejs/plugin-react": "^4.2.1",
"cross-env": "^7.0.3",
"dotenv-cli": "^7.4.2",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
Expand Down
Loading

0 comments on commit bc2eef2

Please sign in to comment.