-
Notifications
You must be signed in to change notification settings - Fork 7
Refactor/docker container #1090
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
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1b1c91b
Ajusta configs de container docker
lucasn4s 3655ecd
Cria script para inicializar o container local
lucasn4s be1ca90
Atualiza readme para utilizar docker
lucasn4s ac6ed83
Move dockerignore
lucasn4s 0f16ad0
Fix issues from PR #1090 review
lucasn4s 8e7ebb8
Ajusta container docker do projeto
lucasn4s 2ec0181
Ajusta script docker
lucasn4s 225cea8
Remove copy desnecessário
lucasn4s 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 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 |
|---|---|---|
| @@ -1,14 +1,17 @@ | ||
| FROM node:16.18.1-alpine3.16 | ||
| FROM node:20-alpine | ||
|
|
||
| COPY bin/entrypoint.sh /usr/local/bin/entrypoint.sh | ||
| WORKDIR /usr/src/app | ||
|
|
||
| RUN mkdir -p /usr/src/app \ | ||
| && apk update \ | ||
| && apk add --no-cache bash==5.1.16-r2 \ | ||
| && rm -rf /var/cache/apk/* \ | ||
| && rm -rf /tmp/* | ||
| RUN apk add --no-cache bash git | ||
|
|
||
| WORKDIR /usr/src/app | ||
| COPY package*.json ./ | ||
|
|
||
| RUN if [ -f package-lock.json ]; then \ | ||
| npm ci --legacy-peer-deps; \ | ||
| else \ | ||
| npm install --legacy-peer-deps; \ | ||
| fi | ||
|
|
||
| EXPOSE 5173 | ||
|
|
||
| EXPOSE 6006 | ||
| ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||
| CMD ["npm", "run", "docs:dev", "--", "--host", "0.0.0.0"] | ||
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,37 @@ | ||
| # Dependencies | ||
| node_modules/ | ||
|
|
||
| # Build outputs | ||
| dist/ | ||
|
|
||
| # Git | ||
| .git/ | ||
| .gitignore | ||
|
|
||
| # IDE | ||
| .idea/ | ||
| .vscode/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Documentation build | ||
| docs/.vitepress/dist/ | ||
|
|
||
| # Test coverage | ||
| coverage/ | ||
|
|
||
| # Logs | ||
| *.log | ||
| npm-debug.log* | ||
|
|
||
| # Misc | ||
| *.md | ||
| !package.json | ||
| !package-lock.json | ||
|
|
||
| # Local docs assets (optional exclusion) | ||
| docs/.vitepress/cache/ |
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
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 |
|---|---|---|
| @@ -1 +1 @@ | ||
| docker-compose exec cuida $* | ||
| docker compose exec cuida $* |
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,46 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| find_port() { | ||
| local port=$1 | ||
| while :; do | ||
| if ! nc -z localhost "$port" 2>/dev/null; then | ||
| echo "$port" | ||
| return 0 | ||
| fi | ||
| ((port++)) | ||
| done | ||
| } | ||
|
|
||
| restore_compose() { | ||
| sed -i '' "s/- \"$PORT:5173\"/- \"5173:5173\"/" docker-compose.yml 2>/dev/null || \ | ||
| sed -i "s/- \"$PORT:5173\"/- \"5173:5173\"/" docker-compose.yml | ||
| } | ||
|
|
||
| if nc -z localhost 5173 2>/dev/null; then | ||
| PORT=$(find_port 5174) | ||
|
lucasn4s marked this conversation as resolved.
|
||
| echo "Port 5173 in use, using port $PORT" | ||
| else | ||
| PORT=5173 | ||
| fi | ||
|
|
||
| # Use temp file for cross-platform sed | ||
| cp docker-compose.yml docker-compose.yml.bak | ||
| trap 'mv docker-compose.yml.bak docker-compose.yml' EXIT | ||
|
|
||
| # macOS compatible sed (add empty string after -i) | ||
| sed -i '' "s/- \"5173:5173\"/- \"$PORT:5173\"/" docker-compose.yml 2>/dev/null || \ | ||
| sed -i "s/- \"5173:5173\"/- \"$PORT:5173\"/" docker-compose.yml | ||
|
|
||
| if ! docker compose up -d; then | ||
| echo "Docker compose failed, restoring original docker-compose.yml" | ||
| mv docker-compose.yml.bak docker-compose.yml | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Restore original (remove trap first) | ||
| trap - EXIT | ||
| mv docker-compose.yml.bak docker-compose.yml | ||
|
|
||
| echo "Docs available at http://localhost:$PORT" | ||
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.