pnp / generator-teams

A Yeoman Generator for Microsoft Teams
https://pnp.github.io/generator-teams
MIT License
423 stars 111 forks source link

Public docker image #151

Open shurick81 opened 4 years ago

shurick81 commented 4 years ago

Is your feature request related to a problem? Please describe. The problem is that in order to try this generator, I need to install the generator and dependencies.

Describe the solution you'd like If there was a public image in Docker Hub, I could just run one command to generate the solution on any machine with docker installed.

Describe alternatives you've considered What we might start with is providing the Dockerfile that other people can use for building an image locally.

wictorwilen commented 3 years ago

Thanks for the idea, and you're reading my mind. I do have a Dockerfile already in the upcoming preview - stay tuned

wictorwilen commented 3 years ago

@shurick81 - here's the Dockerfile I've been using for a project. Any comments, thoughts or additions?

FROM node:14 AS BUILD_IMAGE

RUN curl -sfL https://install.goreleaser.com/github.com/tj/node-prune.sh | bash -s -- -b /usr/local/bin

WORKDIR /app

COPY . /app/

# install 
RUN npm install 

# build
RUN npm run build

# remove development dependencies
RUN npm prune --production

# run node prune
RUN /usr/local/bin/node-prune

FROM node:14-alpine

WORKDIR /app

# copy from build image
COPY --from=BUILD_IMAGE /app/dist ./dist
COPY --from=BUILD_IMAGE /app/node_modules ./node_modules

ENV DEBUG msteams

EXPOSE 3007

CMD [ "node", "dist/server.js" ]
shurick81 commented 3 years ago

@wictorwilen is that an image that one can use for scaffolding new Teams solutions or for building those? Sorry I'm having a hard time figuring this out. That is more or less Dockerfile that I was thinking of when it comes to scaffolding:

FROM node:14-alpine

RUN npm i -g yo generator-teams@2.15.0

VOLUME /usr/app/teams
WORKDIR /usr/app/teams
RUN sed -i -e /rootCheck/d /usr/local/lib/node_modules/yo/lib/cli.js

CMD /bin/bash

And then the usage of the image:

docker run -it --rm -v ${pwd}:/usr/app/teams generator-teams:2.15.0.2 yo teams
wictorwilen commented 3 years ago

Gotcha! This was more meant for publishing the application.

wictorwilen commented 3 years ago

@shurick81 - what if you helped with testing this, and then we could automate this through Github actions and automatically publish a new version every time there's a new release?

shurick81 commented 3 years ago

Sure, I'm in. I will test the one that you shared for the publishing the application and I will get back to you.

shurick81 commented 3 years ago

I have looked at the image you provided, it looks good for testing and hosting purposes. For example, a way to run it will be using some commandline like docker run -it --rm -p 3007:3007 generator-teams:2.15.0.3. Am I taking it right? However, it is not something one should put on a public registry, or?

How about taking a step back and trying to figure out all the possible use cases and then we see how we can facilitate these use cases via publishing some reusable snippets and images. Here's my ideas for use cases:

  1. Scaffolding the solution.
    • Speaking by programming language, yo teams or should we even consider yo @microsoft/sharepoint depending on the desirable scenario?
    • Who is doing: senior developer.
  2. Installing local dependencies in a subfolder of the solution.
    • This part is usually done as a part of scaffolding but also independently, when the source code is shared among different development environments. Speaking by programming language, npm install.
    • Who is doing: any developer or build pipeline.
  3. Debugging.
    • There might be few subscenarios, like gulp serve, gulp ngrok-serve.
    • Who is doing: any developer.
  4. Building.
    • In programming, it might be npm run build and gulp manifest.
    • Who is doing: senior developer, who is manually building release artifacts or build pipeline.
  5. Hosting.
    • This is running the application for stage environment or for production. Can be running with use of Azure container instance, Azure Web App, SharePoint etc.
    • Who is doing: SysOps or deployment pipeline.

So let's check if I got it incorrectly and then we can discuss what exactly we should help developers with?