-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Conversation
There was a problem hiding this 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.
Kudos, SonarCloud Quality Gate passed! |
@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 |
/rtm |
🎉 This PR is included in version 0.3.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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
andnpm
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
andnpm
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 withnode
Docker image instead ofalpine
but with thealpine
version tag:14-alpine3.14
, so we ensure any node version installed would be14.x.x
.Btw, I added
fix:
prefix to force a release because the previous one failed when publishing the Docker image to Docker hub.