Frontend finished

This commit is contained in:
Eden Kirin
2024-01-16 16:45:08 +01:00
parent d77be41b99
commit 636efa9744
6 changed files with 69 additions and 0 deletions

View File

@ -56,3 +56,13 @@ services:
depends_on: depends_on:
- machines-app - machines-app
- products-app - products-app
frontend-app:
build:
context: ./frontend
dockerfile: Dockerfile
environment:
- REACT_APP_BACKEND_API_URL="http://localhost:10000"
ports:
- "8080:80"
depends_on:
- proxy

3
frontend/.dockerignore Normal file
View File

@ -0,0 +1,3 @@
**/node_modules
**/build

20
frontend/Dockerfile Normal file
View File

@ -0,0 +1,20 @@
# stage 1: build node frontend
FROM node:21 as node-builder
WORKDIR /node-builder
COPY ./package.json .
COPY ./package-lock.json .
COPY ./public ./public
COPY ./src ./src
RUN \
npm install && \
npm run build
# stage 2: build final image
FROM nginx:1.25-alpine
COPY --from=node-builder /node-builder/build/. /usr/share/nginx/html
RUN ls -alF /usr/share/nginx/html

36
frontend/Makefile Normal file
View File

@ -0,0 +1,36 @@
CONTAINER_NAME=frontend-app
IMAGE_NAME=komponiranje-frontend-app
run:
@npm start
.PHONY: build
build:
@npm run build
upgrade-packages:
@go get -u ./...
docker-build: clean
@docker build \
--progress=plain \
--tag $(IMAGE_NAME) \
.
docker-run:
@docker run \
--name $(CONTAINER_NAME) \
--publish 8080:80 \
--detach \
$(IMAGE_NAME)
clean:
- @docker stop $(CONTAINER_NAME)
- @docker rm $(CONTAINER_NAME)
- @docker rmi $(IMAGE_NAME)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB