diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3d6d0ef --- /dev/null +++ b/Dockerfile @@ -0,0 +1,16 @@ +FROM ghcr.io/container-projects/base-docker-images:node-12-npm-yo-latest +USER root +RUN mkdir /code/ +COPY . /code/. +RUN npm i -g /code/. +RUN \ + # configure the "yo" user + groupadd yo && \ + useradd yo -s /bin/bash -m -g yo -G sudo && \ + echo yo:yo |chpasswd +RUN mkdir /home/yo/app +USER yo +ENV PATH $PATH:/usr/bin +WORKDIR "/home/yo/app" +VOLUME ["/home/yo/app"] +CMD ["yo"] \ No newline at end of file diff --git a/README.md b/README.md index 6bcefc5..3c64f9b 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,34 @@ yo front-to-back:django Answer a few simple questions and configure your app in a few seconds! +## Using Docker + + +Build the Docker images: + +```bash +docker build -t generator-front-to-back:latest . +``` + +Make a folder where you want to generate the Service: + +```bash +mkdir service +cd service +``` + +Run the generator from image to generate service: + +```bash +docker run -it --rm -v $PWD:/home/yo/app generator-front-to-back +``` + +Run and attach interactive shell to the generator docker container to work from inside the running container: + +```bash +docker run -it --rm -v $PWD:/home/yo/app generator-front-to-back /bin/bash +``` + ## Features ### Javascript