Skip to content

Commit

Permalink
Fix docker build and publish using new repository structure
Browse files Browse the repository at this point in the history
  • Loading branch information
webair committed May 2, 2024
1 parent 0791712 commit 417b044
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/dist
10 changes: 6 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ FROM base AS install_dependencies
WORKDIR /app
COPY package.json .
COPY package-lock.json .
COPY package/package.json package/package.json
COPY package/package.json package/package.json
RUN npm ci

FROM base AS verify
WORKDIR /app
COPY --from=install_dependencies /app /app
COPY src src
COPY .prettierrc.json eslint.config.js index.html tsconfig.json ./
COPY package package
COPY eslint.config.js index.html ./
COPY *.ts .
RUN npm run verify

Expand All @@ -20,8 +22,8 @@ RUN npm run build

FROM base
WORKDIR /app
COPY --from=build /app/dist /app/dist
COPY --from=build /app/package.json /app/package.json
COPY --from=build /app/package/dist /app/dist
COPY --from=build /app/package/package.json /app/package.json
COPY docker-entrypoint.sh /bin/entrypoint.sh
ENTRYPOINT ["/bin/entrypoint.sh"]

23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,27 @@ Check format/lint issues, typescript types and run tests
npm run verify
```

### Publish
### Continuous integration and publishing
For continuous integration and package publishing a multistage Docker build is used. this enables ci/cd execution both locally and on a ci server.

```sh
docker build -t publish_vue_examples --progress plain .
Install dependencies:
```shell
docker build -t publish_vue_examples --target install_dependencies .
```

Verify package:
```shell
docker build -t publish_vue_examples --target verify .
```

Build package:
```shell
docker build -t publish_vue_examples --target build .
```

Publish package:
```shell
docker build -t publish_vue_examples .
docker run -e NPM_AUTH_TOKEN="<Npm Auth Token>" publish_vue_examples
```

Expand Down
3 changes: 2 additions & 1 deletion package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"type": "module",
"repository": {
"type": "git",
"url": "https://github.com/rethinc/vite-plugin-vue-examples.git"
"url": "git+https://github.com/rethinc/vite-plugin-vue-examples.git",
"directory": "package"
},
"files": [
"dist"
Expand Down

0 comments on commit 417b044

Please sign in to comment.