Optimizing docker build

pull/11/head
Edi 5 years ago committed by ioedeveloper
parent f4b039e96d
commit 6a6cf80346
  1. 1
      .dockerignore
  2. 5
      .gitignore
  3. 21
      Dockerfile
  4. 18
      Dockerfile.dev
  5. 37
      apps/remix-ide/README.md
  6. 15
      build.yaml
  7. 8
      ci/build_and_publish_docker_images.sh
  8. 6
      docker-compose.yaml
  9. 40
      nginx.conf

@ -0,0 +1 @@
node_modules

5
.gitignore vendored

@ -37,4 +37,7 @@ testem.log
# System Files
.DS_Store
Thumbs.db
contracts
TODO
.tern-port
temp_publish_docker

@ -1,19 +1,6 @@
FROM node:10
# Create Remix user, don't use root!
# RUN yes | adduser --disabled-password remix && mkdir /app
# USER remix
FROM nginx:alpine
WORKDIR /
# #Now do remix stuff
# USER remix
WORKDIR /home/remix
COPY ./temp_publish_docker/ /usr/share/nginx/html/
RUN git clone https://github.com/ethereum/remix-ide.git
RUN git checkout origin remix_live
WORKDIR /home/remix/remix
RUN npm install
RUN npm run build
EXPOSE 8080 65520
CMD ["npm", "run", "serve"]
EXPOSE 80

@ -10,11 +10,19 @@ WORKDIR /home/remix
COPY ./ ./
WORKDIR /home/remix/remix
# npm ci would probably be better
RUN npm install
RUN npm ci
RUN npm run build
EXPOSE 8080 65520
FROM nginx:alpine
WORKDIR /
CMD ["npm", "run", "serve"]
COPY --from=0 /home/remix/build/ /usr/share/nginx/html/build/
COPY --from=0 /home/remix/index.html /usr/share/nginx/html/index.html
COPY --from=0 /home/remix/nginx.conf /etc/nginx/nginx.conf
COPY --from=0 /home/remix/assets/ /usr/share/nginx/html/assets/
COPY --from=0 /home/remix/icon.png /usr/share/nginx/html/icon.png
COPY --from=0 /home/remix/background.js /usr/share/nginx/html/background.js
COPY --from=0 /home/remix/soljson.js /usr/share/nginx/html/soljson.js
COPY --from=0 /home/remix/package.json /usr/share/nginx/html/package.json
EXPOSE 80

@ -45,6 +45,43 @@ npm run setupremix # only if you plan to link remix and remix-ide repositories
npm start
```
## Docker:
Prerequisites:
* Docker (https://docs.docker.com/desktop/)
* Docker-compose (https://docs.docker.com/compose/install/)
### Run with docker
If you want to run latest changes that are merged into master branch then run:
```
docker pull remixproject/remix-ide:latest
docker run -p 8080:80 remixproject-remix-ide:latest
```
If you want to run latest remix-live release run.
```
docker pull remixproject/remix-ide:remix_live
docker run -p 8080:80 remixproject-remix-ide:remix_live
```
### Run with docker-compose:
To run locally without building you only need docker-compose.yaml file and you can run:
```
docker-compose pull
docker-compose up -d
```
Then go to http://localhost:8080 and you can use you Remix instance.
To fetch docker-compose file without cloning this repo run:
```
curl https://raw.githubusercontent.com/ethereum/remix-ide/master/docker-compose.yaml > docker-compose.yaml
```
## DEVELOPING:
Run `npm start` and open `http://127.0.0.1:4200` in your browser.

@ -0,0 +1,15 @@
version: "3.7"
x-project-base:
&project-base
restart: always
networks:
- remixide
networks:
remixide:
services:
remixide:
build:
context: .
dockerfile: Dockerfile

@ -1,12 +1,16 @@
#!/bin/bash
set -e
# If not staging and master branch are existing
export TAG="$CIRCLE_BRANCH"
if [ "$CIRCLE_BRANCH" == "master" ]; then
export TAG="latest";
fi
rm -rf temp_publish_docker
mkdir temp_publish_docker
cp -r $FILES_TO_PACKAGE temp_publish_docker
docker login --username $DOCKER_USER --password $DOCKER_PASS
docker-compose build
docker-compose -f docker-compose.yaml -f build.yaml build
docker push remixproject/remix-ide:$TAG

@ -13,6 +13,6 @@ services:
<<: *project-base
image: remixproject/remix-ide:$TAG
container_name: remixide-${TAG}
build:
context: .
dockerfile: Dockerfile.dev
ports:
- 8080:80
- 65520:65520

@ -0,0 +1,40 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 300;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
listen [::]:80 default_server;
root /usr/share/nginx/html;
index index.html index.htm;
server_name _;
location / {
try_files $uri $uri/ /index.html;
}
}
}
Loading…
Cancel
Save