git.iko.soy/rowtype-yoga/ry-starter-spa
on main help sign in
Add Dockerfile (#14)
commit3c87c0e54b06c07913f786f10ec0231cc8f37bc5 authorMark Eibes <mark.eibes@gmail.com> dateFri 31 Jul 2020, 20:39 (6 years ago) parent96ed4b9
2 files changed+48−10
.github/workflows/ci.yml+29−10 Dockerfile+19
.github/workflows/ci.yml+29−10
@@ -11,20 +11,39 @@ on:
1111
1212jobs:
1313 build:
14− name: Test and Bundle
14+ name: Test, Bundle, and Dockerise
1515 runs-on: ubuntu-20.04
1616 steps:
1717
18− # Install Zephyr manually
19− - run: curl -Ls https://github.com/coot/zephyr/releases/download/v0.3.2/Linux.tar.gz | tar -xvz -C /tmp
20− - run: sudo cp /tmp/zephyr/zephyr /usr/local/bin/
18+ - name: Download Zephyr release
19+ run: curl -Ls https://github.com/coot/zephyr/releases/download/v0.3.2/Linux.tar.gz | tar -xvz -C /tmp
20+ - name: Copy Zephyr to PATH
21+ run: sudo cp /tmp/zephyr/zephyr /usr/local/bin/
2122
22− # Install yarn
23− - run: sudo npm install -g yarn
23+ - name: Install yarn
24+ run: sudo npm install -g yarn
2425
2526 # Run actual tasks
2627 - uses: actions/checkout@v2
27− - run: yarn install
28− - run: yarn test
29− - run: yarn build-storybook
30− - run: yarn bundle
28+ ## Frontend
29+ - name: Install Frontend Dependencies
30+ run: yarn install
31+ - name: Test Frontend
32+ run: yarn test
33+ - name: Build Storybook
34+ run: yarn build-storybook
35+ - name: Bundle Frontend
36+ run: yarn bundle
37+
38+ ## UI Server
39+ - name: Install UI Server Dependencies
40+ working-directory: ui-server
41+ run: yarn install
42+ - name: Build UI Server
43+ working-directory: ui-server
44+ run: yarn build
45+
46+ ## Build docker image
47+ ## The Dockerfile requires the two previous steps
48+ - name: Build Docker image
49+ run: docker build .
Dockerfilenew file+19
@@ -0,0 +1,19 @@
1+FROM node:12
2+
3+# Create app directory
4+WORKDIR /usr/src/app
5+
6+RUN mkdir node_modules output
7+
8+# Copy server code
9+COPY ui-server/node_modules node_modules/
10+COPY ui-server/output output/
11+COPY ui-server/index.js ./
12+
13+# Copy frontend bundle
14+COPY dist/bundle.js dist/bundle.js.gz ./
15+
16+# Make sure the port is accessible
17+EXPOSE 55555
18+
19+CMD [ "node", "index.js" ]