mirror of
https://github.com/Telecominfraproject/wlan-cloud-graphql-gw.git
synced 2025-10-30 10:12:39 +00:00
update docker
This commit is contained in:
16
.github/workflows/dockerimage.yml
vendored
16
.github/workflows/dockerimage.yml
vendored
@@ -1,16 +0,0 @@
|
|||||||
name: Docker Image CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
build:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Build the Docker image
|
|
||||||
run: docker build . --file Dockerfile --tag wlan-cloud-graphql-gw:$(date +%s)
|
|
||||||
76
.github/workflows/dockerpublish.yml
vendored
Normal file
76
.github/workflows/dockerpublish.yml
vendored
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
name: Docker Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
# Publish `master` as Docker `latest` image.
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
# Publish `v1.2.3` tags as releases.
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
|
||||||
|
# Run tests for any PRs.
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: wlan-cloud-graphql-gw
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
- name: Build image
|
||||||
|
run: docker build . --file Dockerfile --tag image
|
||||||
|
|
||||||
|
- name: Login to TIP Docker registry
|
||||||
|
uses: azure/docker-login@v1
|
||||||
|
with:
|
||||||
|
login-server: tip-tip-wlan-cloud-docker-repo.jfrog.io
|
||||||
|
username: build-pipeline
|
||||||
|
password: ${{ secrets.REPO_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Push image
|
||||||
|
run: |
|
||||||
|
IMAGE_ID=${{ github.repository }}/$IMAGE_NAME
|
||||||
|
|
||||||
|
# Change all uppercase to lowercase
|
||||||
|
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
||||||
|
|
||||||
|
# Strip git ref prefix from version
|
||||||
|
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
||||||
|
|
||||||
|
# Strip "v" prefix from tag name
|
||||||
|
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
||||||
|
|
||||||
|
# Use Docker `latest` tag convention
|
||||||
|
[ "$VERSION" == "master" ] && VERSION=latest
|
||||||
|
|
||||||
|
echo IMAGE_ID=$IMAGE_ID
|
||||||
|
echo VERSION=$VERSION
|
||||||
|
|
||||||
|
docker tag image $IMAGE_ID:$VERSION
|
||||||
|
docker push $IMAGE_ID:$VERSION
|
||||||
@@ -10,10 +10,10 @@ COPY package*.json ./
|
|||||||
|
|
||||||
#RUN npm install
|
#RUN npm install
|
||||||
# If you are building your code for production
|
# If you are building your code for production
|
||||||
RUN npm ci --only=production
|
RUN npm install
|
||||||
|
|
||||||
# Bundle app source
|
# Bundle app source
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
EXPOSE 4000
|
EXPOSE 4000
|
||||||
CMD [ "npm", "start" ]
|
CMD [ "npm", "run", "prod" ]
|
||||||
3
docker-compose.test.yml
Normal file
3
docker-compose.test.yml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
sut:
|
||||||
|
build: .
|
||||||
|
command: npm test
|
||||||
@@ -21,6 +21,7 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "NODE_ENV=development node -r esm src/index.js",
|
"start": "NODE_ENV=development node -r esm src/index.js",
|
||||||
|
"prod": "node -r esm src/index.js",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"format": "prettier --write \"src/**/*.js\"",
|
"format": "prettier --write \"src/**/*.js\"",
|
||||||
"eslint-fix": "eslint --fix . --ext .js --ext .gql --ext .graphql --max-warnings=0"
|
"eslint-fix": "eslint --fix . --ext .js --ext .gql --ext .graphql --max-warnings=0"
|
||||||
|
|||||||
Reference in New Issue
Block a user