-
Notifications
You must be signed in to change notification settings - Fork 22
feat: prepare docker #648
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: prepare docker #648
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
952b4cb
feat: prepare docker
bodinsamuel 17fed71
missing attacha
bodinsamuel 0c0671b
remove unnecessary ignore
bodinsamuel fcec2eb
add release
bodinsamuel 148a656
yarn.lock
bodinsamuel b910bee
chmod
bodinsamuel 71a0d1b
mmh :F
bodinsamuel d9297b4
also ignore release.config.js
bodinsamuel e30d554
review
bodinsamuel 59556f0
indent
bodinsamuel 8687f90
use node
bodinsamuel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,18 @@ version: 2.1 | |
| orbs: | ||
| node: circleci/[email protected] | ||
|
|
||
| aliases: | ||
| # Forward the current folder when using workflows | ||
| - &persist_work_dir | ||
| root: . | ||
| paths: | ||
| - . | ||
|
|
||
| - &attach_work_dir | ||
| at: ~/repo | ||
|
|
||
| jobs: | ||
| # Step build | ||
| build: | ||
| docker: | ||
| - image: cimg/node:14.16.1 | ||
|
|
@@ -12,9 +23,10 @@ jobs: | |
|
|
||
| steps: | ||
| - checkout | ||
| - persist_to_workspace: *persist_work_dir | ||
|
|
||
| - node/install-packages: | ||
| pkg-manager: yarn | ||
| pkg-manager: yarn | ||
|
|
||
| - run: | ||
| name: Lint | ||
|
|
@@ -28,10 +40,32 @@ jobs: | |
| name: Test | ||
| command: yarn test | ||
|
|
||
| - persist_to_workspace: *persist_work_dir | ||
| - store_test_results: | ||
| path: junit/ | ||
|
|
||
| # Step release | ||
| release: | ||
| docker: | ||
| - image: cimg/node:14.16.1 | ||
| working_directory: ~/repo | ||
| steps: | ||
| - attach_workspace: *attach_work_dir | ||
| - run: | ||
| name: Release | ||
| command: yarn semantic-release | ||
| - run: | ||
| name: Docker | ||
| command: yarn docker:build && yarn docker:release | ||
|
|
||
| workflows: | ||
| suite: | ||
| jobs: | ||
| - build | ||
|
|
||
| - release: | ||
| requires: | ||
| - build | ||
| filters: | ||
| branches: | ||
| only: master | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| # Dependencies | ||
| **/node_modules | ||
|
|
||
| # Useless and heavy folders | ||
| **/dist | ||
| coverage/ | ||
| junit/ | ||
|
|
||
| # Logs | ||
| **/*.log | ||
| **/.env* | ||
|
|
||
| # Other useless files in the image | ||
| cypress/ | ||
| .git/ | ||
| .github/ | ||
| .githooks/ | ||
| .circleci/ | ||
| .husky/ | ||
| .nodemon.json | ||
| .editorconfig | ||
| .gitattributes | ||
| .coveralls.yml | ||
| .prettierignore | ||
| .prettierrc.js | ||
| .eslintrc.js | ||
| .nvmrc | ||
| .npmrc | ||
| .eslintignore | ||
| .eslinrcjs | ||
| .tern-project | ||
| cypress.json | ||
| cloudbuild.yaml | ||
| docker-compose.yml | ||
| MAINTAINERS.md | ||
| README.md | ||
| CHANGELOG.md | ||
| CONTRIBUTING.md | ||
| **/*.test.ts | ||
| **/*.test.tsx | ||
| **/*.test.js | ||
| **/*.stories.tsx | ||
| **/*.spec.ts | ||
| **/*.spec.js | ||
| **/*.perf.ts | ||
| package-lock.json | ||
| renovate.json | ||
| **/jest* | ||
| **/.DS_Store | ||
| .vscode | ||
| **/.storybook/ | ||
| **/__fixtures__/ | ||
| **/__snapshots__/ | ||
| **/__mocks__/ | ||
| **/__mock__/ | ||
| **/__tests__/ | ||
| **/tsconfig.tsbuildinfo | ||
| Procfile | ||
| release.config.js |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| # ---- Base ---- | ||
| FROM node:14.16.1-alpine AS base | ||
|
|
||
| ENV NODE_ENV production | ||
|
|
||
| # Setup the app WORKDIR | ||
| WORKDIR /app | ||
|
|
||
| # Copy and install dependencies separately from the app's code | ||
| # To leverage Docker's cache when no dependency has change | ||
| COPY package.json yarn.lock ./ | ||
|
|
||
| # Install dev dependencies | ||
| RUN true \ | ||
| # && yarn set version berry \ | ||
| && yarn install --production=false | ||
|
|
||
| # This step will invalidates cache | ||
| COPY . /app | ||
| RUN ls -lah /app | ||
|
|
||
| # Builds the UI install only the prod dependencies | ||
bodinsamuel marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| RUN true \ | ||
| && yarn build \ | ||
| && yarn install --production=true \ | ||
| && rm -rf src \ | ||
| && rm -rf .yarn/ | ||
|
|
||
| # ---- Final ---- | ||
| # Resulting new, minimal image | ||
| # This image must have the minimum amount of layers | ||
| FROM node:14.16.1-alpine as final | ||
|
|
||
| # Do not use root to run the app | ||
| USER node | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY --from=base --chown=node:node /app /app | ||
|
|
||
| EXPOSE 8000 | ||
|
|
||
| CMD [ "npm", "start" ] | ||
Haroenv marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /* eslint-disable import/no-commonjs */ | ||
| /* eslint-disable no-template-curly-in-string */ | ||
| module.exports = { | ||
| branches: 'master', | ||
| verifyConditions: ['@semantic-release/github'], | ||
| prepare: [ | ||
| { | ||
| path: '@semantic-release/changelog', | ||
| changelogFile: 'CHANGELOG.md', | ||
| }, | ||
| '@semantic-release/npm', | ||
| { | ||
| path: '@semantic-release/git', | ||
| assets: ['package.json', 'CHANGELOG.md'], | ||
| message: | ||
| 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}', | ||
| }, | ||
| ], | ||
| publish: ['@semantic-release/github'], | ||
| success: [], | ||
| fail: [], | ||
| npmPublish: false, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #! /bin/sh | ||
|
|
||
| set -e | ||
|
|
||
| current=$(npx json -f package.json version) | ||
| echo "Releasing: $current" | ||
| echo "" | ||
|
|
||
| docker build \ | ||
| -t algolia/npm-search \ | ||
| -t "algolia/npm-search:${current}" \ | ||
| . |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.