mirror of
https://git.vectorsigma.ru/public/photoview.git
synced 2026-08-03 21:09:05 +00:00
Set $NODE_ENV according to the image purpose during Docker build (#1088)
* Set $NODE_ENV according to the image purpose during Docker build * Move `husky` from dev-deps to prod-deps, as it is used during prod `npm ci` --------- Co-authored-by: Konstantin Koval <kkb@ukr.net>
This commit is contained in:
1
.github/workflows/build.yml
vendored
1
.github/workflows/build.yml
vendored
@@ -124,6 +124,7 @@ jobs:
|
|||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
build-args: |
|
build-args: |
|
||||||
|
NODE_ENV=production
|
||||||
VERSION=${{ github.ref_name }}
|
VERSION=${{ github.ref_name }}
|
||||||
COMMIT_SHA=${{ github.sha }}
|
COMMIT_SHA=${{ github.sha }}
|
||||||
|
|
||||||
|
|||||||
2
.github/workflows/tests.yml
vendored
2
.github/workflows/tests.yml
vendored
@@ -105,6 +105,8 @@ jobs:
|
|||||||
tags: photoview/ui
|
tags: photoview/ui
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
build-args: |
|
||||||
|
NODE_ENV=testing
|
||||||
|
|
||||||
- name: Test
|
- name: Test
|
||||||
id: test
|
id: test
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ FROM --platform=${BUILDPLATFORM:-linux/amd64} node:18 AS ui
|
|||||||
# See for details: https://github.com/hadolint/hadolint/wiki/DL4006
|
# See for details: https://github.com/hadolint/hadolint/wiki/DL4006
|
||||||
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
|
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
|
||||||
|
|
||||||
|
ARG NODE_ENV
|
||||||
|
ENV NODE_ENV=${NODE_ENV:-production}
|
||||||
|
|
||||||
ARG REACT_APP_API_ENDPOINT
|
ARG REACT_APP_API_ENDPOINT
|
||||||
ENV REACT_APP_API_ENDPOINT=${REACT_APP_API_ENDPOINT}
|
ENV REACT_APP_API_ENDPOINT=${REACT_APP_API_ENDPOINT}
|
||||||
|
|
||||||
|
|||||||
@@ -7,17 +7,19 @@ services:
|
|||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
target: ui
|
target: ui
|
||||||
|
args:
|
||||||
|
- NODE_ENV=development
|
||||||
env_file: ui/example.env
|
env_file: ui/example.env
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app:rw
|
- .:/app:rw
|
||||||
ports:
|
ports:
|
||||||
- 1234:1234
|
- 1234:1234
|
||||||
command:
|
command:
|
||||||
- /bin/bash
|
- /bin/bash
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
npm ci
|
npm ci
|
||||||
npm run mon
|
npm run mon
|
||||||
|
|
||||||
dev-api:
|
dev-api:
|
||||||
image: photoview/api
|
image: photoview/api
|
||||||
@@ -32,20 +34,20 @@ services:
|
|||||||
PHOTOVIEW_MYSQL_URL: photoview:photosecret@tcp(mysql)/photoview_test
|
PHOTOVIEW_MYSQL_URL: photoview:photosecret@tcp(mysql)/photoview_test
|
||||||
PHOTOVIEW_POSTGRES_URL: postgres://photoview:photosecret@postgres:5432/photoview_test
|
PHOTOVIEW_POSTGRES_URL: postgres://photoview:photosecret@postgres:5432/photoview_test
|
||||||
volumes:
|
volumes:
|
||||||
- .:/app:rw
|
- .:/app:rw
|
||||||
ports:
|
ports:
|
||||||
- 4001:4001
|
- 4001:4001
|
||||||
command:
|
command:
|
||||||
- /bin/bash
|
- /bin/bash
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
export $(cat /env)
|
export $(cat /env)
|
||||||
reflex -g '*.go' -s -- go run .
|
reflex -g '*.go' -s -- go run .
|
||||||
|
|
||||||
mariadb:
|
mariadb:
|
||||||
image: mariadb:lts
|
image: mariadb:lts
|
||||||
profiles:
|
profiles:
|
||||||
- mysql
|
- mysql
|
||||||
environment:
|
environment:
|
||||||
MYSQL_DATABASE: photoview_test
|
MYSQL_DATABASE: photoview_test
|
||||||
MYSQL_USER: photoview
|
MYSQL_USER: photoview
|
||||||
@@ -53,31 +55,31 @@ services:
|
|||||||
MYSQL_RANDOM_ROOT_PASSWORD: yes
|
MYSQL_RANDOM_ROOT_PASSWORD: yes
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test:
|
test:
|
||||||
- CMD
|
- CMD
|
||||||
- mariadb-admin
|
- mariadb-admin
|
||||||
- --user=photoview
|
- --user=photoview
|
||||||
- --password=photosecret
|
- --password=photosecret
|
||||||
- ping
|
- ping
|
||||||
interval: 20s
|
interval: 20s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
expose:
|
expose:
|
||||||
- "3306"
|
- "3306"
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:16-alpine
|
image: postgres:16-alpine
|
||||||
profiles:
|
profiles:
|
||||||
- postgres
|
- postgres
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_DB: photoview_test
|
POSTGRES_DB: photoview_test
|
||||||
POSTGRES_USER: photoview
|
POSTGRES_USER: photoview
|
||||||
POSTGRES_PASSWORD: photosecret
|
POSTGRES_PASSWORD: photosecret
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test:
|
test:
|
||||||
- CMD
|
- CMD
|
||||||
- pg_isready
|
- pg_isready
|
||||||
interval: 20s
|
interval: 20s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 10
|
retries: 10
|
||||||
expose:
|
expose:
|
||||||
- "5432"
|
- "5432"
|
||||||
|
|||||||
6
ui/package-lock.json
generated
6
ui/package-lock.json
generated
@@ -27,6 +27,7 @@
|
|||||||
"classnames": "^2.3.1",
|
"classnames": "^2.3.1",
|
||||||
"connect-history-api-fallback": "^2.0.0",
|
"connect-history-api-fallback": "^2.0.0",
|
||||||
"copy-to-clipboard": "^3.3.1",
|
"copy-to-clipboard": "^3.3.1",
|
||||||
|
"husky": "^8.0.1",
|
||||||
"i18next": "^21.8.13",
|
"i18next": "^21.8.13",
|
||||||
"mapbox-gl": "^2.9.1",
|
"mapbox-gl": "^2.9.1",
|
||||||
"postcss": "^8.4.39",
|
"postcss": "^8.4.39",
|
||||||
@@ -60,7 +61,6 @@
|
|||||||
"c8": "^7.11.3",
|
"c8": "^7.11.3",
|
||||||
"eslint": "^8.19.0",
|
"eslint": "^8.19.0",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"husky": "^8.0.1",
|
|
||||||
"i18next-parser": "^8.13.0",
|
"i18next-parser": "^8.13.0",
|
||||||
"lint-staged": "^13.0.3",
|
"lint-staged": "^13.0.3",
|
||||||
"nodemon": "^3.1.4",
|
"nodemon": "^3.1.4",
|
||||||
@@ -8021,7 +8021,6 @@
|
|||||||
"version": "8.0.1",
|
"version": "8.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz",
|
||||||
"integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==",
|
"integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==",
|
||||||
"dev": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"husky": "lib/bin.js"
|
"husky": "lib/bin.js"
|
||||||
},
|
},
|
||||||
@@ -20133,8 +20132,7 @@
|
|||||||
"husky": {
|
"husky": {
|
||||||
"version": "8.0.1",
|
"version": "8.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/husky/-/husky-8.0.1.tgz",
|
||||||
"integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==",
|
"integrity": "sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw=="
|
||||||
"dev": true
|
|
||||||
},
|
},
|
||||||
"hyperlinker": {
|
"hyperlinker": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
|||||||
@@ -58,7 +58,8 @@
|
|||||||
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17",
|
"tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.17",
|
||||||
"url-join": "^5.0.0",
|
"url-join": "^5.0.0",
|
||||||
"vite": "^2.9.13",
|
"vite": "^2.9.13",
|
||||||
"vite-plugin-svgr": "^2.2.0"
|
"vite-plugin-svgr": "^2.2.0",
|
||||||
|
"husky": "^8.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@testing-library/jest-dom": "^5.16.4",
|
"@testing-library/jest-dom": "^5.16.4",
|
||||||
@@ -72,7 +73,6 @@
|
|||||||
"c8": "^7.11.3",
|
"c8": "^7.11.3",
|
||||||
"eslint": "^8.19.0",
|
"eslint": "^8.19.0",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
"husky": "^8.0.1",
|
|
||||||
"i18next-parser": "^8.13.0",
|
"i18next-parser": "^8.13.0",
|
||||||
"lint-staged": "^13.0.3",
|
"lint-staged": "^13.0.3",
|
||||||
"nodemon": "^3.1.4",
|
"nodemon": "^3.1.4",
|
||||||
|
|||||||
Reference in New Issue
Block a user