Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

Swagger

Dockerfile

FROM node:4
RUN apt-get -y update && npm install -g coffee-script && npm install -g forever && npm install -g nodemon && npm install swagger -g

WORKDIR /app
# ADD package.json /app/
# ADD config.json /app/
# RUN npm install
ADD . /app

CMD []

EXPOSE 10010

Creamos instancia de Docker

docker  build -t ${PWD##*/} .

Generamos código base

docker run --rm -it -v $(pwd):/app ${PWD##*/} swagger project create ${PWD##*/}

Movemos el directorio a su lugar

mv ${PWD##*/}/*(DN) .
rm -rf ${PWD##*/}

Bindeamos todas las peticiones no solo las de localhost y habilitamos el CORS

 app.connection({ port: port , host: "0.0.0.0", routes: {cors : true} });

Instalamos dependencias (si se hizo el build en otra maquina)

docker run --rm -it -v $(pwd):/app ${PWD##*/} npm install

Arrancando la App

docker run --rm -it -v $(pwd):/app -p 10010:10010 ${PWD##*/} swagger project start

El editor

 docker run --rm -it -v $(pwd):/app -p 8080:8080 ${PWD##*/} swagger project edit -p 8080 -s --host 0.0.0.0

Abrimos http://127.0.0.1:8080/#/edit

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