0

Currently I'm trying to build container serving VueJS application via Cloud Native Buildpacks.

I already have working Docker file that builds VueJS in production mode and then copy results to nginx image, but I would like to try to use CNB.

So I just have created empty VueJS project for test via vue create vue-tutorial and trying to do with CNB somehting like described there https://cli.vuejs.org/guide/deployment.html#heroku but using CNB.

Does anyone know working recipe how to do that with CNB?

P.S. Currently I'm trying to build that with

pack build spa --path . \                                              SIGINT(2) ↵  17:22:41
  --buildpack  gcr.io/paketo-buildpacks/nodejs \
  --buildpack  gcr.io/paketo-buildpacks/nginx

but getting next error (and I'm not sure that I'm on right way):

===> DETECTING
ERROR: No buildpack groups passed detection.
ERROR: Please check that you are running against the correct path.
ERROR: failed to detect: no buildpacks participating
ERROR: failed to build: executing lifecycle: failed with status code: 100

UPD My current dockerfile

# build stage
FROM node:lts-alpine as build-stage
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
# production stage
FROM nginx:1.19-alpine as production-stage
COPY --from=build-stage /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
Dm3Ch
  • 621
  • 1
  • 10
  • 26
  • can you share the Dockerfile you're using? I don't know much about Vue, but can probably infer a lot from it. – codefinger Jan 11 '21 at 16:19

1 Answers1

1

We chatted about this in Slack, but I wanted to capture it here too:

pack build --buildpack heroku/nodejs --buildpack https://cnb-shim.herokuapp.com/v1/heroku-community/static yourimage

This command may do what you want. The static buildpack used in that example is not yet converted to a cloud native buildpack, but the shim may allow you to build a workable artifact. Then run your image with something like docker run -it -e PORT=5000 -p 5000:5000 yourimagename

codefinger
  • 10,088
  • 7
  • 39
  • 51