From c0b8adda4ee90eddf2eb1682ce1bdc7931e03596 Mon Sep 17 00:00:00 2001 From: Shaun Tabone Date: Sat, 20 Jun 2020 10:59:45 +0200 Subject: [PATCH 1/2] Added Dockerfile for docker support --- .dockerignore | 6 ++++++ Dockerfile | 10 ++++++++++ README.md | 20 +++++++++++++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 .dockerignore create mode 100644 Dockerfile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..2711dc52 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,6 @@ +node_modules/ +out/ +npm-debug.log +!src/test/**/node_modules +package-lock.json +Dockerfile \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..2a111dfc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,10 @@ +FROM node:12-alpine +VOLUME /usr/share/vsce +WORKDIR /src +COPY package.json . +COPY yarn.lock . +RUN yarn +COPY . . +RUN yarn compile +WORKDIR /usr/share/vsce +ENTRYPOINT ["/src/out/vsce"] \ No newline at end of file diff --git a/README.md b/README.md index 03d2bdfc..87b5d6e6 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ ## Requirements -- [Node.js](https://nodejs.org/en/) at least `8.x.x` +- [Node.js](https://nodejs.org/en/) at least `8.x.x` or +- [Docker](https://docker.com/) ## Usage @@ -14,6 +15,23 @@ > **Warning:** When using vsce as a library be sure to sanitize any user input used in API calls, as a security measurement. +### via Node.js + +To install vsce globally, you can use the following command: + +```sh +npm install -g vsce +``` + +### via Docker + +To build your own Docker image, first clone this repository and then run the following commands: + +```sh +docker build -t vsce . +docker run -it -v /host/path/extension:/usr/share/vsce vsce # change /host/path/extension to your actual vsce extension path +``` + ## Development First clone this repository, then: From c0e077093a7c442f8526d17a3cbd4c0a49c6267e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moreno?= Date: Fri, 5 Mar 2021 15:29:52 +0100 Subject: [PATCH 2/2] :lipstick: Docker --- .dockerignore | 6 +++++- .npmignore | 4 +++- Dockerfile | 8 ++++---- README.md | 38 +++++++++++++++++++++++++++----------- 4 files changed, 39 insertions(+), 17 deletions(-) diff --git a/.dockerignore b/.dockerignore index 2711dc52..978c0570 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,4 +3,8 @@ out/ npm-debug.log !src/test/**/node_modules package-lock.json -Dockerfile \ No newline at end of file +Dockerfile +.gitignore +LICENSE +README.md +ThirdPartyNotices.txt \ No newline at end of file diff --git a/.npmignore b/.npmignore index b5f48676..9ddb2ce1 100644 --- a/.npmignore +++ b/.npmignore @@ -9,4 +9,6 @@ yarn.lock .travis.yml .vscode/ out/**/*.d.ts -!out/api.d.ts \ No newline at end of file +!out/api.d.ts +.dockerignore +Dockerfile \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 2a111dfc..e6330543 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,10 @@ FROM node:12-alpine -VOLUME /usr/share/vsce -WORKDIR /src +WORKDIR /opt/vsce COPY package.json . COPY yarn.lock . RUN yarn COPY . . RUN yarn compile -WORKDIR /usr/share/vsce -ENTRYPOINT ["/src/out/vsce"] \ No newline at end of file +VOLUME /workspace +WORKDIR /workspace +ENTRYPOINT ["/opt/vsce/out/vsce"] \ No newline at end of file diff --git a/README.md b/README.md index 87b5d6e6..bc71e979 100644 --- a/README.md +++ b/README.md @@ -6,30 +6,46 @@ ## Requirements -- [Node.js](https://nodejs.org/en/) at least `8.x.x` or -- [Docker](https://docker.com/) +- [Node.js](https://nodejs.org/en/) at least `8.x.x` -## Usage +Or simply [Docker](#via-docker). -`vsce` is meant to be mainly used as a command line tool. It can also be used a library since it exposes a small [API](https://github.com/microsoft/vscode-vsce/blob/master/src/api.ts). +## Usage -> **Warning:** When using vsce as a library be sure to sanitize any user input used in API calls, as a security measurement. +Install vsce globally: -### via Node.js +```sh +npm install -g vsce +``` -To install vsce globally, you can use the following command: +Verify the installation: ```sh -npm install -g vsce +vsce --version ``` -### via Docker +`vsce` is meant to be mainly used as a command line tool. It can also be used a library since it exposes a small [API](https://github.com/microsoft/vscode-vsce/blob/master/src/api.ts). When using vsce as a library be sure to sanitize any user input used in API calls, as a security measurement. -To build your own Docker image, first clone this repository and then run the following commands: +## Usage via Docker + +You can also build a container for running vsce: ```sh +git clone https://github.com/microsoft/vscode-vsce +cd vscode-vsce docker build -t vsce . -docker run -it -v /host/path/extension:/usr/share/vsce vsce # change /host/path/extension to your actual vsce extension path +``` + +Validate the container: + +```sh +docker run -it vsce --version +``` + +Publish your local extension: + +```sh +docker run -it -v $(pwd):/workspace vsce publish ``` ## Development