-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement docker image build for frontend
- Loading branch information
1 parent
c7f7430
commit 9f29669
Showing
12 changed files
with
74 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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,3 @@ | ||
.PHONY: build | ||
build: | ||
docker-compose build |
This file contains 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,18 +1,17 @@ | ||
.PHONY: init-dev | ||
|
||
build: | ||
docker build -t model_garden:latest . | ||
|
||
init-dev: | ||
which virtualenv 1>/dev/null || pip install virtualenv | ||
[ -d .venv ] || virtualenv --python=python3 .venv | ||
. .venv/bin/activate && pip install -U -r requirements.txt -r test-requirements.txt | ||
|
||
.PHONY: lint | ||
lint: | ||
flake8 . | ||
|
||
.PHONY: test | ||
test: | ||
pytest -v --cov=model_garden --cov-report=term-missing --no-cov-on-fail tests | ||
|
||
.PHONY: cov | ||
cov: | ||
pytest -v --cov=model_garden --cov-report=html --no-cov-on-fail tests && open htmlcov/index.html |
This file contains 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 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 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 @@ | ||
node_modules |
This file contains 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,3 +1,3 @@ | ||
PORT=4200 | ||
BACKEND_HOST=localhost | ||
BACKEND_PORT=9000 | ||
REACT_APP_BACKEND_HOST=localhost | ||
REACT_APP_BACKEND_PORT=9000 |
This file contains 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,20 @@ | ||
FROM node:14.2.0 as builder | ||
|
||
RUN mkdir /src | ||
WORKDIR /src | ||
|
||
COPY ./package.json /src/ | ||
COPY ./package-lock.json /src/ | ||
COPY ./tsconfig.json /src/ | ||
COPY ./.env /src/ | ||
RUN npm install | ||
|
||
COPY ./public/ /src/public/ | ||
COPY ./src/ /src/src/ | ||
RUN npm run build | ||
|
||
FROM nginx:stable-alpine | ||
|
||
COPY --from=builder /src/build/ /usr/share/nginx/html | ||
COPY ./nginx-default.conf /etc/nginx/conf.d/default.conf | ||
CMD ["/bin/sh", "-c", "nginx -g 'daemon off;'"] |
This file contains 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 @@ | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
index index.html index.htm; | ||
sub_filter_types *; | ||
sub_filter_once off; | ||
rewrite ^(${BASE_URL})(.*)$ /$2 break; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
|
||
# redirect server error pages to the static page /50x.html | ||
error_page 500 502 503 504 /50x.html; | ||
location = /50x.html { | ||
root /usr/share/nginx/html; | ||
} | ||
} |
This file contains 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 @@ | ||
export const backendUrl = `${process.env.REACT_APP_BACKEND_HOST}:${process.env.REACT_APP_BACKEND_PORT}`; |
This file contains 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,3 +1,4 @@ | ||
export * from "./const" | ||
export * from "./labelingTask.api"; | ||
export * from "./media.api"; | ||
export * from "./main.api"; | ||
export * from "./media.api"; |
This file contains 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 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