Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .env.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CLIENT_ID=
CLIENT_SECRET=
CLIENT_REDIRECT_URI=
BASE_URL=

PORT=

REDIS_URL=
71 changes: 71 additions & 0 deletions Dockerfile2
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
FROM node:20-alpine as builder

WORKDIR /siwe-oidc

# Reference https://github.com/mhart/alpine-node/issues/27#issuecomment-880663905
RUN apk add --no-cache --virtual .build-deps alpine-sdk python3

# Set build arguments
ARG INFURA_ID
ARG WALLET_CONNECT_ID

# Set environment variables
ENV INFURA_ID=${INFURA_ID}
ENV WALLET_CONNECT_ID=${WALLET_CONNECT_ID}

# Copy UI source and static files
COPY --chown=node:node ./static /siwe-oidc/static
COPY --chown=node:node ./js/ui /siwe-oidc/js/ui

# Build UI
WORKDIR /siwe-oidc/js/ui
RUN yarn install
RUN yarn build

# Final stage
FROM node:20-alpine

WORKDIR /siwe-oidc

# Install runtime dependencies and build tools
RUN apk add --no-cache \
openssl \
python3 \
make \
g++ \
gcc

# Copy application source
COPY ./server ./server
WORKDIR /siwe-oidc/server

# Install application dependencies with node-gyp support
RUN npm install

# Build TypeScript
RUN npm run build

# Copy static files from builder
COPY --from=builder /siwe-oidc/static/ ./static/

# Generate RSA key if not provided
RUN if [ -z "$RSA_PEM" ]; then \
openssl genrsa -out /tmp/private.pem 2048 && \
export RSA_PEM=$(cat /tmp/private.pem) && \
rm /tmp/private.pem; \
fi

# Set environment variables
ENV SIWEOIDC_ADDRESS="0.0.0.0"

# Expose port
EXPOSE 8000

# Start the application
CMD ["npm", "start"]

# Labels
LABEL org.opencontainers.image.source="https://github.com/spruceid/siwe-oidc"
LABEL org.opencontainers.image.description="OpenID Connect Identity Provider for Sign-In with Ethereum"
LABEL org.opencontainers.image.licenses="MIT OR Apache-2.0"
LABEL org.opencontainers.image.version="1.0.0"
2 changes: 1 addition & 1 deletion js/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"version": "1.3.0",
"scripts": {
"dev": "webpack serve --port 9080",
"build": "cross-env NODE_ENV=production webpack && mkdir -p ../../static && mv dist/* ../../static/",
"build": "cross-env NODE_ENV=production INFURA_ID=1234 WALLET_CONNECT_ID=aded953fd76c6ee04f0b785bc5cbe5ba webpack && mkdir -p ../../static && mv dist/* ../../static/",
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
},
"dependencies": {
Expand Down
24 changes: 24 additions & 0 deletions server/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"env": {
"node": true,
"es2021": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint", "prettier"],
"rules": {
"prettier/prettier": "error",
"@typescript-eslint/explicit-function-return-type": "warn",
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-explicit-any": "warn"
}
}
25 changes: 25 additions & 0 deletions server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Dependencies
node_modules/

# Build output
dist/

# Environment variables
.env
.env.local
.env.*.local

# Logs
logs/
*.log
npm-debug.log*

# IDE
.idea/
.vscode/
*.swp
*.swo

# OS
.DS_Store
Thumbs.db
8 changes: 8 additions & 0 deletions server/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"semi": true,
"trailingComma": "es5",
"singleQuote": true,
"printWidth": 100,
"tabWidth": 2,
"useTabs": false
}
Loading