mirror of
https://github.com/Telecominfraproject/wlan-cloud-ui.git
synced 2025-11-02 19:57:58 +00:00
docker publish
This commit is contained in:
@@ -1,2 +1,3 @@
|
||||
node_modules
|
||||
npm-debug.log
|
||||
dist
|
||||
23
.github/workflows/dockerpublish.yml
vendored
23
.github/workflows/dockerpublish.yml
vendored
@@ -10,17 +10,40 @@ on:
|
||||
tags:
|
||||
- v*
|
||||
|
||||
# Run tests for any PRs.
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
IMAGE_NAME: wlan-cloud-ui
|
||||
|
||||
jobs:
|
||||
# Run tests.
|
||||
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
if [ -f docker-compose.test.yml ]; then
|
||||
docker-compose --file docker-compose.test.yml build
|
||||
docker-compose --file docker-compose.test.yml run sut
|
||||
else
|
||||
docker build . --file Dockerfile
|
||||
fi
|
||||
push:
|
||||
# Ensure test job passes before pushing image.
|
||||
needs: test
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event_name == 'push'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ssh-key: ${{ secrets.NPM_REPO_AUTH_TOKEN }}
|
||||
|
||||
- name: Build image
|
||||
run: docker build . --file Dockerfile --tag image
|
||||
|
||||
40
.github/workflows/npm-build.yml
vendored
40
.github/workflows/npm-build.yml
vendored
@@ -1,40 +0,0 @@
|
||||
name: NPM CI - TIP WLAN Cloud UI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '12.x'
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v1
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
- name: Install packages
|
||||
run: npm install
|
||||
- name: Build module
|
||||
run: npm run build
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '12.x'
|
||||
registry-url: 'https://tip.jfrog.io/artifactory/api/npm/tip-wlan-cloud-npm-repo/'
|
||||
- name: Publish npm module into tip-wlan-cloud-npm-repo
|
||||
run: npm publish
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_REPO_AUTH_TOKEN }}
|
||||
|
||||
16
Dockerfile
16
Dockerfile
@@ -1,8 +1,12 @@
|
||||
FROM node:12
|
||||
# build environment
|
||||
FROM node:13.12.0-alpine as build
|
||||
|
||||
# Create app directory
|
||||
WORKDIR /app
|
||||
|
||||
# add `/app/node_modules/.bin` to $PATH
|
||||
ENV PATH /app/node_modules/.bin:$PATH
|
||||
|
||||
# Install app dependencies
|
||||
# A wildcard is used to ensure both package.json AND package-lock.json are copied
|
||||
# where available (npm@5+)
|
||||
@@ -15,5 +19,11 @@ RUN npm ci --only=production
|
||||
# Bundle app source
|
||||
COPY . .
|
||||
|
||||
EXPOSE 3000
|
||||
CMD [ "npm", "start" ]
|
||||
CMD [ "npm", "run", "build" ]
|
||||
|
||||
# production environment
|
||||
FROM nginx:stable-alpine
|
||||
COPY --from=dist /app/dist /usr/share/nginx/html
|
||||
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
EXPOSE 80
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
3
docker-compose.test.yml
Normal file
3
docker-compose.test.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
sut:
|
||||
build: .
|
||||
command: npm test
|
||||
17
nginx/nginx.conf
Normal file
17
nginx/nginx.conf
Normal file
@@ -0,0 +1,17 @@
|
||||
server {
|
||||
|
||||
listen 80;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
}
|
||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -13624,7 +13624,7 @@
|
||||
}
|
||||
},
|
||||
"wlan-cloud-ui-library": {
|
||||
"version": "git+ssh://git@github.com/Telecominfraproject/wlan-cloud-ui-library.git#abbb7f2c8eaaeec30662331c0aed190be66c0de6",
|
||||
"version": "git+ssh://git@github.com/Telecominfraproject/wlan-cloud-ui-library.git#00b7bb1f1bb1280549caceadd7a2b05dfbb28d39",
|
||||
"from": "git+ssh://git@github.com/Telecominfraproject/wlan-cloud-ui-library.git"
|
||||
},
|
||||
"word-wrap": {
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
"antd": "^4.0.2",
|
||||
"apollo-boost": "^0.4.7",
|
||||
"clean-webpack-plugin": "^3.0.0",
|
||||
"wlan-cloud-ui-library": "git+ssh://git@github.com/Telecominfraproject/wlan-cloud-ui-library.git",
|
||||
"graphql": "^14.6.0",
|
||||
"graphql-tag": "^2.10.3",
|
||||
"html-webpack-plugin": "^3.2.0",
|
||||
@@ -33,7 +32,8 @@
|
||||
"react-dom": "^16.13.0",
|
||||
"react-helmet": "^5.2.1",
|
||||
"react-router-dom": "^5.1.2",
|
||||
"terser-webpack-plugin": "^2.3.5"
|
||||
"terser-webpack-plugin": "^2.3.5",
|
||||
"wlan-cloud-ui-library": "git+ssh://git@github.com/Telecominfraproject/wlan-cloud-ui-library.git"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.8.7",
|
||||
|
||||
Reference in New Issue
Block a user