mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 07:25:10 +00:00
Move publishing of REST sample Image from AZP to GHA
This patch moves publishing of REST sample image from AZP to GHA. This was the last job running on AZP. Also, this patch fixes an error encounterd during the image build. Publishing of REST sample image is now only executed when pushing to main. Signed-off-by: Tatsuya Sato <tatsuya.sato.so@hitachi.com>
This commit is contained in:
parent
98f748155b
commit
bda72cac00
3 changed files with 14 additions and 49 deletions
11
.github/workflows/rest-sample.yaml
vendored
11
.github/workflows/rest-sample.yaml
vendored
|
|
@ -45,3 +45,14 @@ jobs:
|
|||
- name: Test REST Sample Application
|
||||
run: npm test
|
||||
working-directory: asset-transfer-basic/rest-api-typescript
|
||||
|
||||
- name: Build REST Sample Docker Image
|
||||
run: docker build -t ghcr.io/hyperledger/fabric-rest-sample .
|
||||
working-directory: asset-transfer-basic/rest-api-typescript
|
||||
|
||||
- name: Publish REST Sample Docker Image
|
||||
if: github.event_name == 'push' && (github.ref == 'refs/heads/main')
|
||||
run: |
|
||||
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
||||
docker push ghcr.io/hyperledger/fabric-rest-sample:latest
|
||||
working-directory: asset-transfer-basic/rest-api-typescript
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
FROM node:14-alpine3.14 AS build
|
||||
FROM node:18-alpine3.14 AS build
|
||||
|
||||
RUN apk add --no-cache g++ make python3 dumb-init
|
||||
|
||||
|
|
@ -10,14 +10,14 @@ RUN npm ci
|
|||
RUN npm run build
|
||||
RUN npm prune --production
|
||||
|
||||
FROM node:14-alpine3.14
|
||||
FROM node:18-alpine3.14
|
||||
ENV NODE_ENV production
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=build /usr/bin/dumb-init /usr/bin/dumb-init
|
||||
COPY --chown=node:node --from=build /app .
|
||||
|
||||
EXPOSE 3000
|
||||
EXPOSE 3000
|
||||
|
||||
USER node
|
||||
|
||||
|
|
|
|||
|
|
@ -1,46 +0,0 @@
|
|||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
trigger:
|
||||
- main
|
||||
- release-1.4
|
||||
- release-2.2
|
||||
|
||||
variables:
|
||||
- name: NODE_VER
|
||||
value: 16.x
|
||||
- group: credentials
|
||||
|
||||
jobs:
|
||||
- job: REST_Sample
|
||||
displayName: REST Server Sample
|
||||
pool:
|
||||
vmImage: ubuntu-20.04
|
||||
steps:
|
||||
- task: NodeTool@0
|
||||
inputs:
|
||||
versionSpec: $(NODE_VER)
|
||||
displayName: Install Node.js
|
||||
- script: npm install
|
||||
workingDirectory: asset-transfer-basic/rest-api-typescript
|
||||
displayName: Install REST Sample Dependencies
|
||||
- script: npm run build
|
||||
workingDirectory: asset-transfer-basic/rest-api-typescript
|
||||
displayName: Build REST Sample Application
|
||||
- script: npm test
|
||||
workingDirectory: asset-transfer-basic/rest-api-typescript
|
||||
displayName: Test REST Sample Application
|
||||
- script: |
|
||||
docker build -t ghcr.io/hyperledger/fabric-rest-sample .
|
||||
workingDirectory: asset-transfer-basic/rest-api-typescript
|
||||
displayName: Build REST Sample Docker Image
|
||||
- script: |
|
||||
echo ${GITHUB_PAT} | docker login ghcr.io -u ${GITHUB_USER} --password-stdin
|
||||
docker push ghcr.io/hyperledger/fabric-rest-sample:latest
|
||||
condition: and(succeeded(),eq(variables['Build.Reason'], 'IndividualCI'))
|
||||
workingDirectory: asset-transfer-basic/rest-api-typescript
|
||||
displayName: Publish REST Sample Docker Image
|
||||
env:
|
||||
GITHUB_USER: $(GITHUB_USER)
|
||||
GITHUB_PAT: $(GITHUB_PAT)
|
||||
Loading…
Reference in a new issue