Skip to content

Commit

Permalink
[deployment] adding job to deploy protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
prashant3863 committed Sep 22, 2023
1 parent 34c9f86 commit 7b8d2bd
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 2 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/fly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- main
jobs:
deploy:
deploy_rolodex:
name: Deploy app
runs-on: ubuntu-latest
steps:
Expand All @@ -17,3 +17,16 @@ jobs:
flyctl deploy --remote-only --ha=false
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
deploy_protocol:
name: Deploy app
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- name: Deploy Protocol
run: |
ls
cd protocol
flyctl deploy --remote-only --ha=false
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
1 change: 1 addition & 0 deletions protocol/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
45 changes: 45 additions & 0 deletions protocol/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# syntax = docker/dockerfile:1

# Adjust NODE_VERSION as desired
ARG NODE_VERSION=20.6.1
FROM node:${NODE_VERSION}-slim as base

LABEL fly_launch_runtime="Node.js"

# Node.js app lives here
WORKDIR /app

# Set production environment
ENV NODE_ENV="production"


# Throw-away build stage to reduce size of final image
FROM base as build

# Install packages needed to build node modules
RUN apt-get update -qq && \
apt-get install -y build-essential pkg-config python-is-python3

# Install node modules
COPY --link package.json ./
RUN npm install --include=dev

# Copy application code
COPY --link . .

# Build application
RUN npm run build

# Remove development dependencies
RUN npm prune --omit=dev


# Final stage for app image
FROM base

# Copy built application
COPY --from=build /app /app

# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD [ "npm", "run", "start" ]
2 changes: 1 addition & 1 deletion protocol/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { keyToDID } from '@spruceid/didkit-wasm-node';
import { broadcast, eventProcessor } from './event.js'
import { getRegistry, getFollowers, getFollowing} from './indexer.js'

const port = process.argv[2];
const port = process.argv[2] || 3000;
const peer = process.argv[3];
const server = express();

Expand Down

0 comments on commit 7b8d2bd

Please sign in to comment.