@@ -16,82 +16,23 @@ The build and testing of the software is automated and every change or iteration
16
16
17
17
![ Actions] ( img/actions.png )
18
18
19
- ### A template GitHub Action
19
+ ### A template GitHub Action - Create React App
20
20
21
- * Declarative Actions YML script
22
-
23
- ``` yml
24
- name : Docker
25
-
26
- on :
27
- push
28
- env :
29
- IMAGE_NAME : helloworld
30
-
31
- jobs :
32
- push :
33
- runs-on : ubuntu-latest
34
- steps :
35
- - uses : actions/checkout@v2
36
-
37
- - name : Build image
38
- run : docker build . --file Dockerfile --tag $IMAGE_NAME
39
-
40
- - name : Log into registry
41
- run : echo "${{ secrets.GH_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
42
-
43
- - name : Push image
44
- run : |
45
- IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME
46
-
47
- # Change all uppercase to lowercase
48
- IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
49
-
50
- # Strip git ref prefix from version
51
- VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
52
-
53
- # Strip "v" prefix from tag name
54
- [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
55
-
56
- # Use Docker `latest` tag convention
57
- [ "$VERSION" == "master" ] && VERSION=latest
58
-
59
- echo IMAGE_ID=$IMAGE_ID
60
- echo VERSION=$VERSION
61
-
62
- docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
63
- docker push $IMAGE_ID:$VERSION
64
- ` ` `
65
-
66
- * Dockerfile
21
+ * ` Dockerfile `
67
22
68
23
``` dockerfile
69
- # Base Image
70
- FROM ubuntu
71
-
72
- # Commands to be executed on Image Creation
73
- RUN apt-get -y upgrade && apt-get -y update
74
-
75
- # Install Python
76
- RUN apt install -y python3
77
- RUN python3 --version
78
-
79
- # Install Java
80
- RUN apt install -y openjdk-11-jre-headless
81
- RUN java --version
82
-
83
- # Install C++ Compiler
84
- RUN apt install -y g++
85
- RUN g++ --version
24
+ FROM node:14-alpine
25
+ WORKDIR /usr/src/app
26
+ COPY . .
27
+ RUN npm install
28
+ EXPOSE 3000
29
+ CMD [ "npm" , "start" ]
30
+ ```
86
31
87
- # Install Docker
88
- RUN apt install -y docker.io
89
- RUN docker --version
32
+ - ` .dockerignore `
90
33
91
- # Move GitHub source files to Docker Image
92
- RUN mkdir /src
93
- ADD src/ /src
94
- WORKDIR /src
34
+ ```
35
+ node_modules/
95
36
```
96
37
97
38
## Important Links and References
@@ -104,8 +45,6 @@ WORKDIR /src
104
45
105
46
[ GitHub Actions Blog] ( https://iq.opengenus.org/github-actions-using-container-scripts/ )
106
47
107
- [ Learn GitHub Actions] ( https://lab.github.com/githubtraining/github-actions:-hello-world )
108
-
109
48
[ Actions Checkout Repository] ( https://github.com/actions/checkout )
110
49
111
50
[ GitHub Marketplace] ( https://github.com/marketplace )
0 commit comments