-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented github actions
- Loading branch information
Showing
5 changed files
with
180 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: PR | ||
|
||
on: | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js 12 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- name: Cache Node.js modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.OS }}-node- | ||
${{ runner.OS }}- | ||
- run: node --version | ||
|
||
- run: npm install | ||
|
||
- run: npm run build | ||
|
||
- run: npm test | ||
env: | ||
CI: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Fetch all history for all tags and branches | ||
run: git fetch --prune --unshallow | ||
|
||
- name: Install GitVersion | ||
uses: gittools/actions/gitversion/[email protected] | ||
with: | ||
versionSpec: '5.x' | ||
|
||
- name: Use GitVersion | ||
uses: gittools/actions/gitversion/[email protected] | ||
id: gitversion | ||
|
||
- name: Use Node.js 12 | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.x | ||
|
||
- name: Cache Node.js modules | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.OS }}-node- | ||
${{ runner.OS }}- | ||
- run: node --version | ||
|
||
- run: npm install | ||
|
||
- run: npm run build | ||
|
||
- run: npm test | ||
env: | ||
CI: true | ||
|
||
- run: mv ./build ./docker/build | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USER }} | ||
password: ${{ secrets.DOCKER_HUB_TOKEN }} | ||
|
||
- name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: ./docker/ | ||
file: ./docker/Dockerfile | ||
builder: ${{ steps.buildx.outputs.name }} | ||
push: true | ||
tags: | | ||
lifescience/med3web:latest | ||
lifescience/med3web:${{ steps.gitversion.outputs.MajorMinorPatch }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
|
||
- name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
assembly-versioning-scheme: MajorMinorPatch | ||
mode: ContinuousDeployment | ||
next-version: 1.0.0 | ||
branches: {} | ||
ignore: | ||
sha: [] | ||
merge-message-formats: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM nginx:1.19.3-alpine | ||
RUN apk update && apk upgrade && \ | ||
apk add --no-cache curl | ||
WORKDIR /usr/share/nginx/html | ||
COPY ./nginx.conf /etc/nginx/nginx.conf | ||
COPY build . | ||
HEALTHCHECK --interval=10s --timeout=3s \ | ||
CMD curl -f http://localhost:4010/user-count/metrics || exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
worker_processes auto; | ||
error_log /var/log/nginx/error.log warn; | ||
pid /var/run/nginx.pid; | ||
worker_rlimit_nofile 8192; | ||
|
||
events { | ||
worker_connections 4096; | ||
} | ||
|
||
http { | ||
include /etc/nginx/mime.types; | ||
default_type text/html; | ||
|
||
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | ||
'$status $body_bytes_sent "$http_referer" ' | ||
'"$http_user_agent" "$http_x_forwarded_for"'; | ||
|
||
access_log off; | ||
index index.html; | ||
|
||
sendfile on; | ||
tcp_nopush on; | ||
tcp_nodelay on; | ||
keepalive_timeout 15; | ||
reset_timedout_connection on; | ||
|
||
open_file_cache max=200000 inactive=20s; | ||
open_file_cache_valid 30s; | ||
open_file_cache_min_uses 2; | ||
open_file_cache_errors on; | ||
|
||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name _; | ||
|
||
gzip off; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
try_files $uri $uri/ /index.html =404; | ||
add_header Cache-Control "max-age=3600,private"; | ||
} | ||
location ~* \.(?:jpg|jpeg|gif|png|ttf|svg|ico)$ { | ||
root /usr/share/nginx/html; | ||
log_not_found off; | ||
expires max; | ||
add_header Cache-Control "max-age=86400,private"; | ||
} | ||
} | ||
} |