forked from crusher-dev/crusher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLayerfile
73 lines (50 loc) · 2.93 KB
/
Layerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#This is an example webapp.io configuration for NodeJS
FROM vm/ubuntu:18.04
# To note: Layerfiles create VMs, *not* containers!
RUN apt-get update && \
apt-get install apt-transport-https ca-certificates curl software-properties-common && \
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable" && \
apt-get update && \
apt install docker-ce python3 python3-pip awscli && \
curl -sL https://deb.nodesource.com/setup_14.x | bash && \
apt install -y nodejs && \
rm -f /etc/apt/sources.list.d/nodesource.list && snap install cmake --classic
RUN mkdir /ms-playwright && mkdir /tmp/pw && cd /tmp/pw && npm init -y && npm i playwright && DEBIAN_FRONTEND=noninteractive npx playwright install-deps && rm -rf /tmp/pw && chmod -R 777 /ms-playwright
# install docker compose (easily starts required docker containers)
RUN curl -L "https://github.com/docker/compose/releases/download/1.26.2/docker-compose-$(uname -s)-$(uname -m)" \
-o /usr/local/bin/docker-compose
RUN npm install -g yarn pm2
RUN apt install unzip
COPY . .
MEMORY 4G
SECRET ENV SCHEMA_OBJ_URL
SECRET ENV GIT_REPO_FULL
SECRET ENV SLACK_CLIENT_ID
SECRET ENV SLACK_CLIENT_SECRET
# RUN mkdir db && curl "$SCHEMA_OBJ_URL" > db/schema.sql
RUN yarn
RUN yarn setup:ee
BUILD ENV EXPOSE_WEBSITE_HOST
ENV STANDALONE_APP_URL=https://$GIT_BRANCH.test-app.crusher.dev \
NEXT_PUBLIC_INTERNAL_BACKEND_URL=https://$GIT_BRANCH.test-app.crusher.dev/server \
NEXT_PUBLIC_CRUSHER_MODE=enterprise \
CRUSHER_ENV=production \
FILE_SERVER_PROXY=https://$GIT_BRANCH.test-app.crusher.dev/output/
RUN NEXT_PUBLIC_INTERNAL_BACKEND_URL="$NEXT_PUBLIC_INTERNAL_BACKEND_URL" NODE_OPTIONS=--max-old-space-size=8096 sh scripts/build/build-all.sh
RUN rm -R packages && mkdir packages && cp -R output/* packages/
RUN sudo chmod +x /usr/local/bin/docker-compose
RUN cp ./configs/.env.layerci .env
# Start postgres and redis
RUN REPEATABLE STANDALONE_APP_URL="$STANDALONE_APP_URL" docker-compose -f docker/ee/docker-compose.yml up --build -d --force-recreate postgres redis
RUN node setup/dbMigration.js
RUN cp ./ecosystem.config.sample.js ecosystem.config.js
RUN BACKGROUND pm2 start
EXPOSE WEBSITE http://localhost:3000
# To wait for server to starts
RUN BACKGROUND node scripts/waitTillCrusherLoaded.js --url="https://$GIT_BRANCH.test-app.crusher.dev/server" && curl --location --request POST 'https://backend.crusher.dev/projects/258/tests/actions/run' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--cookie "token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjoiMjgyIiwidGVhbV9pZCI6MjE5LCJpYXQiOjE2NTI1MDgzODgsImV4cCI6MTY4NDA0NDM4OH0.FVPHPheotR_ib9lqQkaDkrU0TGqgME0ZCdoyWV7Q-7c" \
--data-urlencode "githubRepoName=$GIT_REPO_FULL" \
--data-urlencode "host=https://$GIT_BRANCH.test-app.crusher.dev" \
--data-urlencode "githubCommitId=$GIT_COMMIT"