Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/create docker image #337

Merged
merged 2 commits into from
Feb 28, 2024
Merged
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
28 changes: 28 additions & 0 deletions devops/dockerfiles/beTests/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM node:18.16.0 AS node_base

RUN echo "NODE Version:" && node --version
RUN echo "NPM Version:" && npm --version

ARG GCC_VERSION=10
ARG CMAKE_VERSION=3.21.0
ARG BRANCH=main

RUN apt-get install -y wget git

# Add a user for running applications.
RUN useradd apps
RUN mkdir -p /home/apps && chown apps:apps /home/apps

# Set the Chrome repo.
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
# Install Chrome.
RUN apt-get update && apt-get -y install google-chrome-stable

RUN git clone -b ${BRANCH} https://github.com/mangata-finance/mangata-e2e.git
WORKDIR /mangata-e2e

RUN rm -rf ./node_modules yarn.lock
RUN yarn

#### docker run -it --network=host --entrypoint=/bin/bash 8ae4fe093944 -c "yarn test-sequential" ####
64 changes: 64 additions & 0 deletions devops/dockerfiles/feTests/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
FROM node:18.16.0 AS node_base

RUN echo "NODE Version:" && node --version
RUN echo "NPM Version:" && npm --version

ARG GCC_VERSION=10
ARG CMAKE_VERSION=3.21.0
ARG BRANCH=main
ARG FE_BRANCH=main
ARG GITHUB_TOKEN
# env variables for micropps
ARG MANGATA_ASSETS_URL=https://storage.googleapis.com/mangata-assets
ARG MANGATA_EXPLORER_URL=https://mangatax.subscan.io
# this points to stash service mock
ARG MANGATA_STASH_URL=http://localhost:3456
#this points to chopsticks mangata ws
ARG MANGATA_API_URL=ws://127.0.0.1:9946
ARG MANGATA_PARACHAIN_ID=2110
ARG MANGATA_TOKEN_ID=0
ARG MANGATA_ANNUAL_MGX_POOL_REWARDS=300000000000000000000000000

RUN apt-get install -y wget git

# Add a user for running applications.
RUN useradd apps
RUN mkdir -p /home/apps && chown apps:apps /home/apps

# Set the Chrome repo.
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list
# Install Chrome.
RUN apt-get update && apt-get -y install google-chrome-stable

RUN git clone -b ${BRANCH} https://github.com/mangata-finance/mangata-e2e.git
WORKDIR /mangata-e2e

RUN rm -rf ./node_modules yarn.lock
RUN yarn


# uncomment if api-key is provided, and comment the ADD command!
# WORKDIR /
# RUN if test -z ${GITHUB_TOKEN} ; then git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/" ; git clone -b ${FE_BRANCH} https://github.com/mangata-finance/microapps.git ; fi

ADD . /microapps/
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, is copying it from the folder you are running the docker build

WORKDIR /microapps
RUN rm -rf ./node_modules yarn.lock
RUN rm .env
RUN yarn


RUN echo MANGATA_ASSETS_URL=${MANGATA_ASSETS_URL} >> .env
RUN echo MANGATA_EXPLORER_URL=${MANGATA_EXPLORER_URL} >> .env
RUN echo MANGATA_STASH_URL=${MANGATA_STASH_URL} >> .env
RUN echo MANGATA_API_URL=${MANGATA_API_URL} >> .env
RUN echo MANGATA_PARACHAIN_ID=${MANGATA_PARACHAIN_ID} >> .env
RUN echo MANGATA_TOKEN_ID=${MANGATA_TOKEN_ID} >> .env
RUN echo MANGATA_ANNUAL_MGX_POOL_REWARDS=${MANGATA_ANNUAL_MGX_POOL_REWARDS} >> .env

#RUN yarn nx serve dex
### how to build ##
#### cd ~/projects/microapps ; docker build -f /home/goncer/projects/mangata-e2e/devops/dockerfiles/feTests/Dockerfile .
## how to run
#### docker run -it --network=host --entrypoint=/bin/bash ca7dfc5ecc66 -c "yarn nx serve dex & sleep 10000000000" ####
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MariuszSzpyt plz take a look and share w. me your thoughts.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, for now however it wont run microapps as its not getting it from anywhere (as the api key part is provided).