Merge pull request #2905 from ethereum/docker_compress1

Optimizing docker build
pull/5370/head
yann300 5 years ago committed by GitHub
commit 8e9aec9992
  1. 1
      .dockerignore
  2. 1
      .gitignore
  3. 21
      Dockerfile
  4. 18
      Dockerfile.dev
  5. 37
      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

1
.gitignore vendored

@ -12,3 +12,4 @@ remix
contracts contracts
TODO TODO
.tern-port .tern-port
temp_publish_docker

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

@ -10,11 +10,19 @@ WORKDIR /home/remix
COPY ./ ./ COPY ./ ./
WORKDIR /home/remix/remix RUN npm ci
# npm ci would probably be better
RUN npm install
RUN npm run build 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 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: ## DEVELOPING:
Run `npm start` and open `http://127.0.0.1:8080` in your browser. Run `npm start` and open `http://127.0.0.1:8080` 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 #!/bin/bash
set -e set -e
# If not staging and master branch are existing
export TAG="$CIRCLE_BRANCH" export TAG="$CIRCLE_BRANCH"
if [ "$CIRCLE_BRANCH" == "master" ]; then
export TAG="latest";
fi
rm -rf temp_publish_docker
mkdir temp_publish_docker mkdir temp_publish_docker
cp -r $FILES_TO_PACKAGE temp_publish_docker cp -r $FILES_TO_PACKAGE temp_publish_docker
docker login --username $DOCKER_USER --password $DOCKER_PASS 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 docker push remixproject/remix-ide:$TAG

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