File tree 4 files changed +81
-14
lines changed
4 files changed +81
-14
lines changed Original file line number Diff line number Diff line change
1
+ name : ' build'
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - v*
7
+
8
+ jobs :
9
+ build :
10
+ runs-on : ubuntu-latest
11
+ steps :
12
+ - uses : actions/checkout@v2
13
+ - name : build
14
+ run : |
15
+ echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u "${{ secrets.GHCR_USER }}" --password-stdin
16
+ docker build -f Dockerfile.production . --tag ghcr.io/${{ github.repository }}:${GITHUB_REF#refs/tags/}
17
+ docker tag ghcr.io/${{ github.repository }}:${GITHUB_REF#refs/tags/} ghcr.io/${{ github.repository }}:latest
18
+ docker push ghcr.io/${{ github.repository }}:${GITHUB_REF#refs/tags/}
19
+ docker push ghcr.io/${{ github.repository }}:latest
Original file line number Diff line number Diff line change 1
- # Dockerfile
2
-
3
- # base image
1
+ # dev env
4
2
FROM node:alpine
5
3
6
- # create & set working directory
7
- RUN mkdir -p /usr/src/app
8
4
WORKDIR /usr/src/app
9
-
10
- # copy source files
11
- COPY . /usr/src/app
12
-
13
- ENV NODE_ENV=production
14
-
15
- # install dependencies
5
+ COPY package*.json ./
16
6
RUN npm install
7
+ COPY . ./
17
8
18
- # start app
19
- RUN npm run build
20
9
EXPOSE 3000
21
10
CMD npm run start
Original file line number Diff line number Diff line change
1
+ # build env
2
+ FROM node:alpine as build
3
+
4
+ WORKDIR /app
5
+ COPY package*.json ./
6
+ RUN npm ci
7
+ COPY . ./
8
+ RUN npm run build
9
+
10
+ # production env
11
+ FROM nginx:stable-alpine
12
+ COPY nginx.conf /etc/nginx/conf.d/default.conf
13
+ COPY --from=build /app/build /usr/share/nginx/html
14
+ EXPOSE 80
15
+ CMD ["nginx", "-g", "daemon off;"]
Original file line number Diff line number Diff line change
1
+ server {
2
+ listen 80 ;
3
+ server_name localhost;
4
+
5
+ #access_log /var/log/nginx/host.access.log main;
6
+
7
+ location / {
8
+ root /usr/share/nginx/html;
9
+ index index.html;
10
+ try_files $uri /index.html;
11
+ }
12
+
13
+ #error_page 404 /404.html;
14
+
15
+ # redirect server error pages to the static page /50x.html
16
+ #
17
+ error_page 500 502 503 504 /50x.html;
18
+ location = /50x.html {
19
+ root /usr/share/nginx/html;
20
+ }
21
+
22
+ # proxy the PHP scripts to Apache listening on 127.0.0.1:80
23
+ #
24
+ #location ~ \.php$ {
25
+ # proxy_pass http://127.0.0.1;
26
+ #}
27
+
28
+ # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
29
+ #
30
+ #location ~ \.php$ {
31
+ # root html;
32
+ # fastcgi_pass 127.0.0.1:9000;
33
+ # fastcgi_index index.php;
34
+ # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
35
+ # include fastcgi_params;
36
+ #}
37
+
38
+ # deny access to .htaccess files, if Apache's document root
39
+ # concurs with nginx's one
40
+ #
41
+ #location ~ /\.ht {
42
+ # deny all;
43
+ #}
44
+ }
You can’t perform that action at this time.
0 commit comments