ソースを参照

pioneer.Dockerfile

Mokhtar Naamani 4 年 前
コミット
0313f482ff
7 ファイル変更39 行追加10 行削除
  1. 2 1
      .dockerignore
  2. 4 3
      README.md
  3. 2 2
      apps.Dockerfile
  4. 4 1
      build-docker-images.sh
  5. 7 0
      docker-compose.yml
  6. 18 0
      pioneer.Dockerfile
  7. 2 3
      start.sh

+ 2 - 1
.dockerignore

@@ -5,6 +5,7 @@ target/
 query-node/generated
 query-node/**/dist
 query-node/lib
-pioneer/
+# rm -f during image build instead of ignoring
+# pioneer/
 cli/
 tests/

+ 4 - 3
README.md

@@ -25,11 +25,11 @@ After cloning the repo run the following initialization scripts:
 # Install rust toolchain
 ./setup.sh
 
-# Install npm package dependencies and build project
+# Install npm package dependencies, build packages and docker images
 yarn build
 
-# run some tests on runtime
-yarn cargo-checks
+# start a local development network
+yarn start
 ```
 
 ## Software
@@ -74,6 +74,7 @@ The HEAD of the master branch should always be used for the correct version of t
 ```sh
 git checkout master
 yarn install
+yarn build:packages
 yarn workspace pioneer start
 ```
 

+ 2 - 2
apps.Dockerfile

@@ -2,13 +2,13 @@ FROM node:12 as builder
 
 WORKDIR /joystream
 COPY . /joystream
+RUN  rm -fr /joystream/pioneer
 
 # Do not set NODE_ENV=production until after running yarn install
 # to ensure dev dependencies are installed.
 RUN yarn --forzen-lockfile
 
-# Pioneer is the 'heaviest' package in terms of dependencies
-# RUN yarn workspace pioneer build
+RUN yarn workspace @joystream/types build
 RUN yarn workspace query-node-root build
 RUN yarn workspace storage-node build
 

+ 4 - 1
build-docker-images.sh

@@ -12,9 +12,12 @@ fi
 echo "Building 'joystream/apps' docker image..."
 docker-compose build colossus
 
+# Build the pioneer docker image
+echo "Building pioneer docker image"
+docker-compose build pioneer
+
 if [[ "$SKIP_JOYSTREAM_NODE" = 1 || "$SKIP_JOYSTREAM_NODE" = "true" ]]; then
   echo "Skipping build of joystream/node docker image."
-  exit 0
 else
   # TODO: Try to fetch a cached joystream/node image
   # if one is found matching code shasum instead of building

+ 7 - 0
docker-compose.yml

@@ -152,3 +152,10 @@ services:
     ports:
       - "127.0.0.1:6379:6379"
 
+  pioneer:
+    image: joystream/pioneer
+    build:
+      context: .
+      dockerfile: pioneer.Dockerfile
+    ports:
+      - "127.0.0.1:3000:80"

+ 18 - 0
pioneer.Dockerfile

@@ -0,0 +1,18 @@
+FROM node:12 as builder
+
+WORKDIR /joystream
+COPY . /joystream
+
+RUN yarn
+RUN NODE_ENV=production yarn workspace @joystream/types build
+RUN NODE_ENV=production yarn workspace pioneer build
+
+FROM ubuntu:18.04
+
+RUN apt-get update && apt-get -y install nginx
+
+COPY --from=builder /joystream/pioneer/packages/apps/build /var/www/html
+
+EXPOSE 80
+
+CMD ["nginx", "-g", "daemon off;"]

+ 2 - 3
start.sh

@@ -41,9 +41,8 @@ export WS_PROVIDER_ENDPOINT_URI=ws://joystream-node:9944
 docker-compose up -d graphql-server
 docker-compose up -d processor
 
-echo 'run: `yarn workspace pioneer start` in a separate terminal to bring up an instance of pioneer and
-point your browser to http://localhost:3000/ to access the UI
-'
+docker-compose up -d pioneer
+
 echo "use Ctrl+C to shutdown the development network."
 
 while true; do