git.iko.soy/rowtype-yoga/ry-starter-spa
on main help sign in
Add Dockerfile (#14)
3c87c0eMark Eibes
.github/workflows/ci.yml+29−10
@@ -11,20 +11,39 @@ on:
11
11
12jobs:
12jobs:
13 build:
13 build:
14− name: Test and Bundle
14+ name: Test, Bundle, and Dockerise
15 runs-on: ubuntu-20.04
15 runs-on: ubuntu-20.04
16 steps:
16 steps:
17
17
18− # Install Zephyr manually
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
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
20− - run: sudo cp /tmp/zephyr/zephyr /usr/local/bin/
21+ run: sudo cp /tmp/zephyr/zephyr /usr/local/bin/
21
22
22− # Install yarn
23+ - name: Install yarn
23− - run: sudo npm install -g yarn
24+ run: sudo npm install -g yarn
24
25
25 # Run actual tasks
26 # Run actual tasks
26 - uses: actions/checkout@v2
27 - uses: actions/checkout@v2
28+ ## Frontend
29+ - name: Install Frontend Dependencies
27− - run: yarn install
30+ run: yarn install
31+ - name: Test Frontend
28− - run: yarn test
32+ run: yarn test
33+ - name: Build Storybook
29− - run: yarn build-storybook
34+ run: yarn build-storybook
35+ - name: Bundle Frontend
30− - run: yarn bundle
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" ]