Skip to content

Commit 5560294

Browse files
committed
Merge branch 'develop' into fb-tiny-keys
2 parents f3f0d27 + 55c83dc commit 5560294

File tree

5 files changed

+181
-0
lines changed

5 files changed

+181
-0
lines changed

.dev-deploy/docker-compose.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
services:
2+
web-connect:
3+
build:
4+
context: ..
5+
dockerfile: .dev-deploy/web-connect.Dockerfile
6+
# args: //TODO make it so the webconnect app builds so it suppots testnet and testnet config
7+
# VITE_PUBLIC_ENVIRONMENT: development
8+
container_name: ${WEB_CONNECT_CONTAINER_NAME}
9+
restart: always
10+
networks:
11+
- cicd_github_deploy_network
12+
13+
web-staking:
14+
build:
15+
context: ..
16+
dockerfile: .dev-deploy/web-staking.Dockerfile
17+
container_name: ${WEB_STAKING_CONTAINER_NAME}
18+
restart: always
19+
environment:
20+
NEXT_PUBLIC_APP_ENV: development
21+
MONGODB_URL: ${MONGODB_URL}
22+
networks:
23+
- cicd_github_deploy_network
24+
25+
26+
networks:
27+
cicd_github_deploy_network:
28+
external: true

.dev-deploy/web-connect.Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Stage 1: Build Stage
2+
FROM node:20.11.0-alpine AS build
3+
4+
# Install pnpm globally
5+
6+
7+
# Set the working directory inside the container
8+
WORKDIR /app
9+
10+
# Copy the entire monorepo to the container, excluding node_modules and other ignored files
11+
COPY . .
12+
13+
# Install all dependencies for the monorepo
14+
RUN pnpm install
15+
16+
# Build the web-staking application
17+
RUN npx nx build @sentry/web-connect
18+
19+
20+
# Stage 2: Release Stage (Production)
21+
FROM node:20.11.0-alpine AS release
22+
23+
# Install the 'serve' package globally to serve static files
24+
RUN npm install -g serve
25+
26+
# Set the working directory inside the release container
27+
WORKDIR /app
28+
29+
# Copy only the build artifacts from the 'build' stage
30+
COPY --from=build /app/apps/web-connect/dist ./dist
31+
32+
# Expose port 3000
33+
EXPOSE 3000
34+
35+
# Start the app using "serve" on port 3000
36+
CMD ["serve", "-s", "dist", "-l", "3000"]

.dev-deploy/web-staking.Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
ARG NEXT_PUBLIC_APP_ENV=development
2+
3+
# Base stage
4+
FROM node:20.11.0 AS release
5+
ARG NEXT_PUBLIC_APP_ENV
6+
7+
# Set environment variables
8+
ENV NEXT_TELEMETRY_DISABLED=1
9+
ENV NEXT_PUBLIC_APP_ENV=development
10+
11+
# Install pnpm globally
12+
13+
14+
# Set the working directory inside the container
15+
WORKDIR /app
16+
17+
# Copy the entire monorepo to the container, excluding node_modules and other ignored files
18+
COPY . .
19+
20+
# Install all dependencies
21+
RUN pnpm i --filter=@sentry/web-staking --config.dedupe-peer-dependents=false
22+
23+
# Build the web-staking application
24+
RUN npx nx build @sentry/web-staking
25+
26+
# Dev expose default port 3000 - should be handled by deployment
27+
EXPOSE 3000
28+
29+
# Dev CMD to run the staking app - handled by deployment
30+
CMD ["npx", "nx", "start", "@sentry/web-staking"]

.github/workflows/pr-close.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: PR close cleanup
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
jobs:
8+
build:
9+
runs-on: self-hosted
10+
11+
steps:
12+
- name: Set container names
13+
run: |
14+
echo "WEB_CONNECT_CONTAINER_NAME=web-connect-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
15+
echo "WEB_STAKING_CONTAINER_NAME=web-staking-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
16+
17+
- name: Check if containers exist and remove them
18+
run: |
19+
# Check if the web-connect container exists, and remove it if it does
20+
if [ "$(docker ps -a -q -f name=${{ env.WEB_CONNECT_CONTAINER_NAME }})" ]; then
21+
docker stop ${{ env.WEB_CONNECT_CONTAINER_NAME }} || true
22+
docker rm ${{ env.WEB_CONNECT_CONTAINER_NAME }} || true
23+
fi
24+
25+
# Check if the web-staking container exists, and remove it if it does
26+
if [ "$(docker ps -a -q -f name=${{ env.WEB_STAKING_CONTAINER_NAME }})" ]; then
27+
docker stop ${{ env.WEB_STAKING_CONTAINER_NAME }} || true
28+
docker rm ${{ env.WEB_STAKING_CONTAINER_NAME }} || true
29+
fi

.github/workflows/pr-review.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: PR deploy
2+
3+
on:
4+
pull_request:
5+
types: [review_requested]
6+
branches:
7+
- "*"
8+
9+
pull_request_review:
10+
types: [submitted]
11+
branches:
12+
- '*'
13+
14+
jobs:
15+
build:
16+
if: github.event_name == 'pull_request' || github.event.review.state == 'approved'
17+
runs-on: self-hosted
18+
19+
steps:
20+
# Step 1: Checkout the code from the PR branch
21+
- name: Checkout code
22+
uses: actions/checkout@v2
23+
24+
# Step 2: Set up environment variables for container names
25+
- name: Set container names
26+
run: |
27+
echo "WEB_CONNECT_CONTAINER_NAME=web-connect-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
28+
echo "WEB_STAKING_CONTAINER_NAME=web-staking-${{ github.event.pull_request.number }}" >> $GITHUB_ENV
29+
30+
# Step 3: Build web-connect and web-staking services using docker compose
31+
- name: Build Docker services
32+
run: |
33+
docker compose -f .dev-deploy/docker-compose.yml build
34+
35+
- name: Check if containers exist and remove them
36+
run: |
37+
# Check if the web-connect container exists, and remove it if it does
38+
if [ "$(docker ps -a -q -f name=${{ env.WEB_CONNECT_CONTAINER_NAME }})" ]; then
39+
docker stop ${{ env.WEB_CONNECT_CONTAINER_NAME }} || true
40+
docker rm ${{ env.WEB_CONNECT_CONTAINER_NAME }} || true
41+
fi
42+
43+
# Check if the web-staking container exists, and remove it if it does
44+
if [ "$(docker ps -a -q -f name=${{ env.WEB_STAKING_CONTAINER_NAME }})" ]; then
45+
docker stop ${{ env.WEB_STAKING_CONTAINER_NAME }} || true
46+
docker rm ${{ env.WEB_STAKING_CONTAINER_NAME }} || true
47+
fi
48+
49+
- name: Run web-connect container
50+
run: |
51+
docker compose -f .dev-deploy/docker-compose.yml run -d --name ${{ env.WEB_CONNECT_CONTAINER_NAME }} web-connect
52+
53+
- name: Run web-staking container
54+
run: |
55+
docker compose -f .dev-deploy/docker-compose.yml run -d --name ${{ env.WEB_STAKING_CONTAINER_NAME }} \
56+
-e NEXT_PUBLIC_APP_ENV=development \
57+
-e MONGODB_URL=${{ secrets.MONGODB_URL }} \
58+
web-staking

0 commit comments

Comments
 (0)