-
Notifications
You must be signed in to change notification settings - Fork 0
[issue-158]: create production mode #160
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
Draft
swotex
wants to merge
6
commits into
main
Choose a base branch
from
feat/issue-158-add-nginx-prod
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3f0e4a3
mode prod/dev (nginx/vite) no api
swotex 4a17c39
rework pro/dev system (nginx/api in prod not working)
swotex a55209a
create nginx to the backend, and connect it
swotex 266f98e
remove comment and clean
swotex 9542e04
pull main and resole conflict
swotex 43c4597
remove -e in makefile
swotex 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 |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| README.md | ||
| .env | ||
| Dockerfile | ||
| docker-compose.yml | ||
| docker-compose.dev.yml | ||
| docker-compose.core.yml | ||
| .gitignore | ||
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,16 @@ | ||
| FROM composer:2.0 | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| RUN apk add --no-cache \ | ||
| php8-pdo \ | ||
| php8-pdo_mysql \ | ||
| php8-mysqli \ | ||
| mysql-client \ | ||
| libpng-dev \ | ||
| php8-fpm | ||
|
|
||
| RUN docker-php-ext-install pdo pdo_mysql gd | ||
|
|
||
| COPY --chmod=777 ./entrypoint_docker.prod.sh . | ||
| ENTRYPOINT ["sh", "entrypoint_docker.prod.sh"] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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,19 @@ | ||
| composer require | ||
|
|
||
| upload_max_filesize=240M | ||
| post_max_size=50M | ||
| max_execution_time=100 | ||
| max_input_time=223 | ||
|
|
||
| for key in upload_max_filesize post_max_size max_execution_time max_input_time | ||
| do | ||
| sed -i "s/^\($key\).*/\1 $(eval echo = \${$key})/" /usr/local/etc/php/php.ini-development | ||
| done | ||
|
|
||
| cp /usr/local/etc/php/php.ini-development /usr/local/etc/php/php.ini | ||
|
|
||
| sed -i 's|^listen =.*|listen = 0.0.0.0:9000|' /etc/php8/php-fpm.d/www.conf | ||
|
|
||
| composer migrate | ||
|
|
||
| php-fpm8 -F |
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,33 @@ | ||
| services: | ||
| frontend: | ||
| image: node:22.11 | ||
| container_name: frontend | ||
| restart: always | ||
| volumes: | ||
| - frontend:/app | ||
| expose: | ||
| - '1212' | ||
| ports: | ||
| - 1212:1212 | ||
| networks: | ||
| - matchaNetwork | ||
| working_dir: /app | ||
| command: sh -c "npm install && npm run dev" | ||
|
|
||
| api: | ||
| build: | ||
| context: ./api/ | ||
| dockerfile: Dockerfile | ||
| container_name: api | ||
| restart: always | ||
| volumes: | ||
| - api:/app | ||
| ports: | ||
| - 3000:3000 | ||
| networks: | ||
| - matchaNetwork | ||
| depends_on: | ||
| mysql: | ||
| condition: service_healthy | ||
| env_file: | ||
| - ./.env |
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,52 @@ | ||
| services: | ||
| nginx: | ||
| build: | ||
| context: . | ||
| dockerfile: ./nginx/Dockerfile | ||
| container_name: nginx | ||
| restart: always | ||
| ports: | ||
| - "1212:1212" | ||
| networks: | ||
| - matchaNetwork | ||
|
|
||
|
|
||
|
|
||
| nginx_api: | ||
| image: nginx:alpine | ||
| container_name: nginx_api | ||
| restart: always | ||
| volumes: | ||
| - api:/app | ||
| - ./nginx/api.conf:/etc/nginx/conf.d/api.conf | ||
| ports: | ||
| - "3000:3000" | ||
| networks: | ||
| - matchaNetwork | ||
| depends_on: | ||
| - api | ||
| command: /bin/sh -c " | ||
| cp -R /app/* /usr/share/nginx/html/ && | ||
| chown -R nginx:nginx /usr/share/nginx/html/ && | ||
| chmod -R 755 /usr/share/nginx/html/ && | ||
| nginx -g 'daemon off;'" | ||
|
|
||
| api: | ||
| build: | ||
| context: ./api/ | ||
| dockerfile: Dockerfile.prod | ||
| container_name: api | ||
| restart: always | ||
| volumes: | ||
| - api:/app | ||
| # ports: | ||
| # - 3000:3000 | ||
| expose: | ||
| - 9000 | ||
| networks: | ||
| - matchaNetwork | ||
| depends_on: | ||
| mysql: | ||
| condition: service_healthy | ||
| env_file: | ||
| - ./.env |
This file was deleted.
Oops, something went wrong.
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,15 @@ | ||
| FROM node:22.11 AS builder | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| COPY ./frontend/ ./ | ||
|
|
||
| RUN npm install && npm run build | ||
|
|
||
| FROM nginx:alpine | ||
|
|
||
| COPY --from=builder /app/dist /usr/share/nginx/html | ||
|
|
||
| COPY ./nginx/conf.d /etc/nginx/conf.d | ||
|
|
||
| CMD ["nginx", "-g", "daemon off;"] |
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move to |
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,18 @@ | ||
| server { | ||
| listen 3000; | ||
| server_name api; | ||
| root /app/public; | ||
| index index.php; | ||
|
|
||
| location / { | ||
| try_files $uri $uri/ /index.php?$query_string; | ||
| } | ||
| location ~ \.php$ { | ||
| fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
| fastcgi_pass api:9000; | ||
| fastcgi_index index.php; | ||
| include fastcgi_params; | ||
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
| fastcgi_param PATH_INFO $fastcgi_path_info; | ||
| } | ||
| } |
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,10 @@ | ||
| server { | ||
| listen 1212; | ||
| server_name matcha; | ||
| root /usr/share/nginx/html; | ||
| index index.html; | ||
|
|
||
| location / { | ||
| try_files $uri $uri/ /index.html; | ||
| } | ||
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.