diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..82bd9aff2 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +node_modules +package-lock.json +.git +.gitignore +.vscode +.next +.turbo \ No newline at end of file diff --git a/README.md b/README.md index 974118dc2..157b5ce92 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,33 @@ If something is misconfigured, check out the docs for | [`types`](./packages/types) | Types used across packages. | | [`utils`](./packages/utils) | Utility functions used across packages. | +### Building Docker Images + +To create a dockerized image, simply run the following commands: + +#### For DAPP + +```sh +docker-compose build dapp --build-arg BUILDPLATFORM=linux/arm64 --build-arg TARGETPLATFORM=linux/amd64 +``` + +#### For SDA + +```sh +docker-compose build sda --build-arg BUILDPLATFORM=linux/arm64 --build-arg TARGETPLATFORM=linux/amd64 +``` + +**Note:** Set the `DAPP_IMAGE` and `SDA_IMAGE` environment variables to your desired image names, e.g.: + +```bash +DAPP_IMAGE=da0-da0/dao-app-dapp:v0.0.2 +SDA_IMAGE=da0-da0/dao-app-sda:v0.0.2 +``` + +These commands will build the images for the specified platforms. Just replace `linux/arm64` and `linux/amd64` with your machine's platform and the intended platform for the image, respectively. + +**Important:** Please note that building images for cross-platform architectures can take a significant amount of time, as the build process needs to compile and package the image for the target platform. Be patient and let the build process complete. You can grab a cup of coffee or take a short break while you wait! + ## Contributing Interested in contributing to DAO DAO? Check out diff --git a/akash-deploy.sdl b/akash-deploy.sdl new file mode 100644 index 000000000..c6446ee59 --- /dev/null +++ b/akash-deploy.sdl @@ -0,0 +1,59 @@ +--- +version: "2.0" +services: + dapp: + image: da0-da0/dao-app-dapp:v0.0.2 + expose: + - port: 3000 + as: 80 + accept: + - daodao.zone + - www.daodao.zone + to: + - global: true + sda: + image: da0-da0/dao-app-sda:v0.0.2 + expose: + - port: 3000 + as: 80 + accept: + - sda.daodao.zone + - www.sda.daodao.zone + to: + - global: true +profiles: + compute: + dapp: + resources: + cpu: + units: 4 + memory: + size: 16GB + storage: + - size: 120GB + sda: + resources: + cpu: + units: 4 + memory: + size: 16GB + storage: + - size: 120GB + placement: + dcloud: + pricing: + dapp: + denom: uakt + amount: 10000 + sda: + denom: uakt + amount: 10000 +deployment: + dapp: + dcloud: + profile: dapp + count: 1 + sda: + dcloud: + profile: sda + count: 1 \ No newline at end of file diff --git a/apps/dapp/.dockerignore b/apps/dapp/.dockerignore new file mode 100644 index 000000000..e41b05f6a --- /dev/null +++ b/apps/dapp/.dockerignore @@ -0,0 +1,6 @@ +node_modules +package-lock.json +.git +.gitignore +.vscode +.turbo \ No newline at end of file diff --git a/apps/dapp/Dockerfile b/apps/dapp/Dockerfile new file mode 100644 index 000000000..1cf85c318 --- /dev/null +++ b/apps/dapp/Dockerfile @@ -0,0 +1,30 @@ +# Use the official Node.js image as the base +FROM node:18 +# Set the working directory to /app +WORKDIR /app + +# Copy env variables +COPY ./apps/dapp/.env.testnet . + +# Copy the package.json and yarn.lock files +COPY package*.json yarn.lock ./ + +# Install the workspace dependencies using yarn first +RUN yarn install + +# Copy entire repo into the docker container +COPY . . + +# Change to the apps/dapp directory +WORKDIR /app/apps/dapp + +# Install the dependencies specifically for dapp +RUN yarn install --network-timeout 900000 + +# Build the DAPP, make sure build doesnt crash +ENV NODE_OPTIONS=--max_old_space_size=8192 + +# default +RUN yarn build +EXPOSE 3000 +CMD ["yarn", "run", "start"] \ No newline at end of file diff --git a/apps/sda/.dockerignore b/apps/sda/.dockerignore new file mode 100644 index 000000000..e41b05f6a --- /dev/null +++ b/apps/sda/.dockerignore @@ -0,0 +1,6 @@ +node_modules +package-lock.json +.git +.gitignore +.vscode +.turbo \ No newline at end of file diff --git a/apps/sda/Dockerfile b/apps/sda/Dockerfile new file mode 100644 index 000000000..fbb03b6a4 --- /dev/null +++ b/apps/sda/Dockerfile @@ -0,0 +1,30 @@ +# Use the official Node.js image as the base +FROM node:18 +# Set the working directory to /app +WORKDIR /app + +# Copy env variables +COPY ./apps/sda/.env.testnet . + +# Copy the package.json and yarn.lock files +COPY package*.json yarn.lock ./ + +# Install the workspace dependencies using yarn first +RUN yarn install + +# Copy entire repo into the docker container +COPY . . + +# Change to the apps/sda directory +WORKDIR /app/apps/sda + +# Install the dependencies specifically for sda +RUN yarn install --network-timeout 900000 + +# Build the SDA, make sure build doesnt crash +ENV NODE_OPTIONS=--max_old_space_size=8192 + +# default +RUN yarn build +EXPOSE 3000 +CMD ["yarn", "run", "start"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..922f44aa7 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +services: + sda: + build: + context: . + dockerfile: apps/sda/Dockerfile + args: + - BUILDPLATFORM + - TARGETPLATFORM + image: ${SDA_IMAGE} + platform: linux/amd64 + dapp: + build: + context: . + dockerfile: apps/dapp/Dockerfile + args: + - BUILDPLATFORM + - TARGETPLATFORM + image: ${DAPP_IMAGE} + platform: linux/amd64 \ No newline at end of file