Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use node image as base to ensure version range #51

Merged
merged 1 commit into from
Feb 14, 2022

Conversation

smoya
Copy link
Member

@smoya smoya commented Feb 11, 2022

Description

This PR fixes the current CI error on release: https://github.com/asyncapi/server-api/runs/5158849217?check_suite_focus=true.

The issue behind it is that alpine version got both nodejs and npm updated, so the specified version (14.18.1-r0) is no longer available.
In order to avoid the same problem in the future, we could either install both nodejs and npm packages without version modifier (not sure which version it will be installed if they keep updating it), use a fixed repository for installing those versions or rather, (the solution I chose) stick with node Docker image instead of alpine but with the alpine version tag: 14-alpine3.14, so we ensure any node version installed would be 14.x.x.

Btw, I added fix: prefix to force a release because the previous one failed when publishing the Docker image to Docker hub.

@smoya smoya requested a review from magicmatatjahu February 11, 2022 16:52
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@magicmatatjahu
Copy link
Member

@smoya Thanks for PR! I understand you tested the image on your machine?

@smoya
Copy link
Member Author

smoya commented Feb 14, 2022

@smoya Thanks for PR! I understand you tested the image on your machine?

❯ docker build --no-cache --tag asyncapi/server-api .
[+] Building 153.4s (16/16) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                         0.0s
 => => transferring dockerfile: 37B                                                                                                                                          0.0s
 => [internal] load .dockerignore                                                                                                                                            0.0s
 => => transferring context: 34B                                                                                                                                             0.0s
 => [internal] load metadata for docker.io/library/node:14-alpine3.14                                                                                                        2.1s
 => [auth] library/node:pull token for registry-1.docker.io                                                                                                                  0.0s
 => CACHED [base 1/2] FROM docker.io/library/node:14-alpine3.14@sha256:8c93166ecea91d8384d9f1768ceaca1cd8bc22c1eb13005cecfb491588bd8169                                      0.0s
 => [internal] load build context                                                                                                                                            0.0s
 => => transferring context: 4.60kB                                                                                                                                          0.0s
 => [base 2/2] RUN apk add --update   nghttp2                                                                                                                                1.2s
 => [build 1/4] WORKDIR /app                                                                                                                                                 0.0s
 => [build 2/4] COPY . .                                                                                                                                                     0.1s
 => [build 3/4] RUN rm package-lock.json; npm install                                                                                                                       93.3s
 => [build 4/4] RUN npm run build:prod                                                                                                                                      12.5s
 => [release 2/5] COPY --from=build /app/dist ./dist                                                                                                                         0.0s
 => [release 3/5] COPY --from=build /app/package* ./                                                                                                                         0.4s
 => [release 4/5] RUN npm ci --only=production                                                                                                                              29.5s
 => [release 5/5] COPY openapi.yaml ./                                                                                                                                       0.0s
 => exporting to image                                                                                                                                                      10.3s
 => => exporting layers                                                                                                                                                     10.3s
 => => writing image sha256:1ce56098b22c6149a662de7d0e0f9aaca1910f615794d40eca5d082d35999576                                                                                 0.0s
 => => naming to docker.io/asyncapi/server-api                                                                                                                               0.0s

❯ docker run -p 80:80 asyncapi/server-api

> @asyncapi/[email protected] start:prod /app
> NODE_ENV=production node dist/server.js

2022-02-14 12:27:12 info: =================================
2022-02-14 12:27:12 info: = ENV: production
2022-02-14 12:27:12 info: = 🚀 AsyncAPI Server API listening on the port 80
2022-02-14 12:27:12 info: =================================

And

❯ curlie -X POST 'localhost/v1/validate' -H "Content-Type: application/json" -d '{"asyncapi":{"asyncapi":"2.2.0","info":{"title":"Account Service","version":"1.0.0","description":"This service is in charge of processing user signups"},"channels":{"user/signedup":{"subscribe":{"message":{"$ref":"#/components/messages/UserSignedUp"}}}},"components":{"messages":{"UserSignedUp":{"payload":{"type":"object","properties":{"displayName":{"type":"string","description":"Name of the user"},"email":{"type":"string","format":"email","description":"Email of the user"}}}}}}}}'
HTTP/1.1 204 No Content
X-Powered-By: Express
Vary: Origin
Date: Mon, 14 Feb 2022 12:33:42 GMT
Connection: keep-alive
Keep-Alive: timeout=5

@magicmatatjahu
Copy link
Member

/rtm

@asyncapi-bot asyncapi-bot merged commit 1b4f10f into asyncapi:master Feb 14, 2022
@smoya smoya deleted the fix/docker branch February 14, 2022 14:08
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 0.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants