-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into diego/set-static-ip
- Loading branch information
Showing
1,292 changed files
with
52,746 additions
and
24,686 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,50 @@ | ||
# Prevent Dockerfile modifications to trigger layer recomputation | ||
build/Dockerfile | ||
Dockerfile | ||
|
||
# Dependencies | ||
node_modules/ | ||
|
||
# Accelerate COPY build/src . command | ||
packages/*/node_modules/ | ||
packages/*/tmp_dnp_repo/ | ||
packages/*/dnp_repo/ | ||
packages/*/DNCORE/ | ||
packages/*/cache/ | ||
packages/*/dappmanagerdb.json | ||
packages/*/npm-debug.log | ||
packages/*/yarn-error.log | ||
|
||
# Compiled files | ||
packages/*/build/ | ||
packages/*/dist | ||
|
||
# Test artifacts | ||
test_build/ | ||
test_build/* | ||
test_build/.git/ | ||
test_build/.git/* | ||
packages/*/undefined/ | ||
packages/*/test_files/ | ||
packages/*/test_files/* | ||
packages/*/test_mountpoints_*/ | ||
packages/*/test_mountpoints_*/* | ||
packages/*/.temp-transfer/ | ||
packages/*/.temp-transfer/* | ||
|
||
# Test files | ||
packages/admin-ui/src/__tests__ | ||
packages/dappmanager/test | ||
packages/*/*test* | ||
packages/*/src/*test* | ||
|
||
# Version data file | ||
.version.json | ||
# Dev artifacts | ||
packages/*/.prettierrc* | ||
packages/*/.prettierignore | ||
#packages/*/.eslintrc* | ||
packages/*/.eslintignore | ||
packages/*/.mocharc* | ||
|
||
# UI | ||
packages/*/node_modules | ||
packages/*/npm-debug.log | ||
# README files | ||
README.md | ||
packages/*/README.md | ||
|
||
# Mock server is only for developing | ||
packages/*/server-mock | ||
# Version data file | ||
.version.json | ||
|
||
# Version builds | ||
build_*/ | ||
build_*/ | ||
|
||
# Package admin-ui files | ||
packages/admin-ui/server-mock | ||
packages/admin-ui/__mock-backend__ | ||
packages/admin-ui/tsconfig.server-mock.json | ||
packages/admin-ui/nodemon.json | ||
|
||
# Package dappmanager files | ||
packages/dappmanager/dnp_repo | ||
packages/dappmanager/DNCORE | ||
packages/dappmanager/maindb.json | ||
packages/dappmanager/test_mountpoints | ||
|
||
# toolkit files | ||
packages/toolkit/truffle/* | ||
packages/toolkit/theGraph/* | ||
packages/toolkit/fixTypesImports.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: NPM Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
packageName: | ||
description: "Package Name (schemas, types, toolkit)" | ||
required: true | ||
version: | ||
description: "Version to publish (e.g., 1.0.0)" | ||
required: true | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Validate package name | ||
run: | | ||
if [[ ${{ github.event.inputs.packageName }} != "schemas" && ${{ github.event.inputs.packageName }} != "types" && ${{ github.event.inputs.packageName }} != "toolkit" ]]; then | ||
echo "Error: Invalid package name" | ||
exit 1 | ||
fi | ||
- name: Validate version | ||
run: | | ||
if ! [[ ${{ github.event.inputs.version }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
echo "Error: Invalid version format" | ||
exit 1 | ||
fi | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
registry-url: "https://registry.npmjs.org" | ||
|
||
- name: Install dependencies and build | ||
run: yarn && yarn build | ||
|
||
- name: Build and Publish | ||
run: | | ||
cd packages/${{ github.event.inputs.packageName }} | ||
yarn publish --new-version ${{ github.event.inputs.version }} --access public --non-interactive --no-git-tag-version | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
token: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,125 +1,52 @@ | ||
ARG NODE_VERSION=19.2.0 | ||
|
||
############ | ||
# GIT-DATA # | ||
############ | ||
FROM --platform=${BUILDPLATFORM:-amd64} node:${NODE_VERSION}-alpine as git-data | ||
|
||
WORKDIR /usr/src/app | ||
RUN apk add --no-cache git | ||
|
||
COPY .git .git | ||
COPY dappnode_package.json . | ||
COPY docker/getGitData.js . | ||
|
||
RUN node getGitData /usr/src/app/.git-data.json | ||
|
||
################## | ||
# BUILD-BINARIES # | ||
################## | ||
FROM --platform=${BUILDPLATFORM:-amd64} node:${NODE_VERSION}-alpine as build-binaries | ||
|
||
RUN apk add --no-cache bind-tools docker curl | ||
RUN curl -L https://github.com/docker/compose/releases/download/v2.5.0/docker-compose-linux-$(uname -m) > /usr/local/bin/docker-compose \ | ||
&& chmod +x /usr/local/bin/docker-compose | ||
ARG NODE_VERSION=20.3.0 | ||
|
||
# Common base so it's cached | ||
# --platform=$BUILDPLATFORM is used build javascript source with host arch | ||
# Otherwise webpack builds on emulated archs can be extremely slow (+1h) | ||
ARG BASE_IMAGE=node:${NODE_VERSION}-alpine3.18 | ||
|
||
############# | ||
# BUILD-SRC # | ||
############# | ||
FROM --platform=${BUILDPLATFORM:-amd64} node:${NODE_VERSION}-alpine as build-src | ||
# Initial stage to gather git data | ||
FROM --platform=${BUILDPLATFORM:-amd64} ${BASE_IMAGE} as git-data | ||
WORKDIR /usr/src/app | ||
RUN apk add --no-cache git | ||
COPY .git dappnode_package.json docker/getGitData.js ./ | ||
RUN node getGitData /usr/src/app/.git-data.json | ||
|
||
# Build source files | ||
FROM --platform=${BUILDPLATFORM:-amd64} ${BASE_IMAGE} as build-src | ||
WORKDIR /app | ||
RUN apk add --no-cache python3 build-base | ||
|
||
# Copy and install deps first to cache | ||
COPY package.json yarn.lock lerna.json tsconfig.json ./ | ||
COPY patches patches/ | ||
RUN yarn --frozen-lockfile --non-interactive --ignore-scripts --ignore-optional | ||
COPY packages/admin-ui/package.json \ | ||
packages/admin-ui/ | ||
COPY packages/dappmanager/package.json \ | ||
packages/dappmanager/ | ||
COPY packages/common/package.json \ | ||
packages/common/ | ||
RUN yarn --frozen-lockfile --non-interactive --ignore-optional | ||
|
||
# Build common | ||
WORKDIR /app/packages/common/ | ||
COPY packages/common/ . | ||
RUN yarn build | ||
# Results in dist/* | ||
|
||
# Build admin-ui | ||
WORKDIR /app/packages/admin-ui/ | ||
COPY packages/admin-ui/ . | ||
COPY packages packages | ||
# For the admin-ui | ||
ENV REACT_APP_API_URL / | ||
RUN yarn build | ||
# Results in build/* | ||
|
||
# Build dappmanager | ||
WORKDIR /app/packages/dappmanager/ | ||
COPY packages/dappmanager/ . | ||
RUN yarn build | ||
# Results in dist/* | ||
|
||
############## | ||
# BUILD-DEPS # | ||
############## | ||
|
||
FROM --platform=${BUILDPLATFORM:-amd64} node:${NODE_VERSION}-alpine as build-deps | ||
RUN yarn --frozen-lockfile --non-interactive --ignore-optional && \ | ||
yarn build && \ | ||
yarn clean:libraries && \ | ||
yarn install --non-interactive --frozen-lockfile --production --force --ignore-optional | ||
RUN rm -rf yarn.lock packages/*/node_modules packages/*/src packages/*/tsconfig.json packages/*/.eslint* | ||
|
||
WORKDIR /usr/src/app | ||
RUN apk add --no-cache python3 | ||
COPY --from=build-src /app . | ||
RUN yarn install --non-interactive --frozen-lockfile --production --force --ignore-optional | ||
|
||
############## | ||
# PRODUCTION # | ||
############## | ||
# Production stage | ||
FROM node:${NODE_VERSION}-alpine | ||
|
||
ENV COMPOSE_HTTP_TIMEOUT=300 \ | ||
DOCKER_CLIENT_TIMEOUT=300 \ | ||
DOCKER_HOST=unix:///var/run/docker.sock \ | ||
UI_FILES_PATH=/usr/src/app/packages/admin-ui/build \ | ||
GIT_DATA_PATH=.git-data.json | ||
WORKDIR /usr/src/app | ||
|
||
# TODO: consider moving all these binaries to the build-binaries stage | ||
RUN apk add --no-cache bind-dev xz libltdl miniupnpc zip unzip dbus bind avahi-tools | ||
|
||
# Copy docker | ||
COPY docker/rndc.conf /etc/bind/ | ||
COPY docker/update_local_dyndns.sh /usr/local/bin/update_local_dyndns | ||
# TODO: Remove bind modules when we don't use Bind package? | ||
# These packages create several files | ||
RUN apk add --no-cache docker curl docker-cli-compose xz zip unzip libltdl bind bind-dev bind-tools avahi-tools dbus miniupnpc | ||
|
||
# Copy git data | ||
COPY --from=git-data /usr/src/app/.git-data.json $GIT_DATA_PATH | ||
|
||
# Copy binaries | ||
COPY --from=build-binaries /usr/bin/nsupdate /usr/bin/nsupdate | ||
COPY --from=build-binaries /usr/bin/docker /usr/bin/docker | ||
COPY --from=build-binaries /usr/local/bin/docker-compose /usr/local/bin/docker-compose | ||
|
||
# Copy scripts and services | ||
COPY packages/dappmanager/hostScripts /usr/src/app/hostScripts | ||
COPY packages/dappmanager/hostServices /usr/src/app/hostServices | ||
# Copy scripts | ||
COPY packages/hostScriptsServices/hostScripts hostScripts | ||
COPY packages/hostScriptsServices/hostServices hostServices | ||
COPY packages/hostScriptsServices/hostTimers hostTimers | ||
|
||
# Copy root app | ||
COPY --from=build-deps /usr/src/app/node_modules ./node_modules | ||
COPY --from=build-deps /usr/src/app/package.json ./package.json | ||
# Copy common | ||
COPY --from=build-deps /usr/src/app/packages/common/dist ./packages/common/dist | ||
COPY --from=build-deps /usr/src/app/packages/common/node_modules ./packages/common/node_modules | ||
COPY --from=build-deps /usr/src/app/packages/common/package.json ./packages/common/package.json | ||
# Copy admin-ui | ||
COPY --from=build-deps /usr/src/app/packages/admin-ui/build ./packages/admin-ui/build | ||
# Copy dappmanager | ||
COPY --from=build-deps /usr/src/app/packages/dappmanager/dist /usr/src/app/packages/dappmanager/dist | ||
COPY --from=build-deps /usr/src/app/packages/dappmanager/node_modules /usr/src/app/packages/dappmanager/node_modules | ||
COPY --from=build-deps /usr/src/app/packages/dappmanager/package.json /usr/src/app/packages/dappmanager/package.json | ||
COPY package.json ./ | ||
COPY --from=build-src /app/packages ./packages | ||
COPY --from=build-src /app/node_modules ./node_modules | ||
|
||
CMD [ "node", "packages/dappmanager/dist/index" ] |
Oops, something went wrong.