Skip to content
Snippets Groups Projects
Commit b4395864 authored by Jacopo Gasparetto's avatar Jacopo Gasparetto
Browse files

feat(ci-cd): Add automatic build for nginx/frontend image

parent 8e9dd344
No related branches found
No related tags found
2 merge requests!8feat(deployment): Add frontend container based on nginx,!7feat(ci-cd): Frontend container image based on nginx
Pipeline #100142 passed
......@@ -94,7 +94,7 @@ test:
script:
echo "Hello, Test!"
upload-frontend:
upload-frontend-package:
stage: upload
before_script:
- PACKAGENAME="$(cat packagename.txt)"
......@@ -112,3 +112,24 @@ upload-frontend:
- dev
- /^(([0-9]+)\.)?([0-9]+)\.x/ # Maintenance branches
- /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/ # Prerelease branches
upload-frontend-docker:
stage: upload
before_script:
- PACKAGENAME="$(cat packagename.txt)"
- VERSION="$(cat version.txt)"
- PACKAGE_FULLNAME="${PACKAGENAME}_v${VERSION}.tar.gz"
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
script:
- tar -xvf frontend/${PACKAGE_FULLNAME} -C frontend/build
- docker build --pull -t "${CI_REGISTRY_IMAGE}/frontend:v${VERSION}" frontend -f Dockerfile.prod
- docker push "${CI_REGISTRY_IMAGE}/frontend:v${VERSION}"
only:
changes:
- .gitlab-ci.yml
- frontend/**/*
refs:
- main
- dev
- /^(([0-9]+)\.)?([0-9]+)\.x/ # Maintenance branches
- /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/ # Prerelease branches
......@@ -13,10 +13,35 @@ To run the project, use
docker compose up
```
## Endpoints
## Development Endpoints
The following endpoint are available
- Webapp [localhost:8080](localhost:8080)
- API [localhost:8080/api/v1/](localhost:8080/api/v1/)
- Webapp [localhost:3000](localhost:3000)
- API [localhost:3000/api/v1/](localhost:3000/api/v1/)
- Minio [localhost:9000](localhost:9000)
## Deployment
This project is configured with a CI/CD pipeline which builds two Docker images
for backend and frontend services. The images are stored
[here](https://baltig.infn.it/jgasparetto/ceph-webapp-poc/container_registry).
### Frontend Configuration
The frontend service consists in a NGINX web server provided with the static
website files produces by React build. The site must be configure as a
"Single Page App" (SPA). In this context, all routes routed through the web
browser must be **always** redirect to the `/` route.
[Here](frontend/nginx.conf) you can find a configuration example which you can
use as
```shell
docker run -p 8080:80 -v $(pwd)/frontend/nginx.conf:/etc/nginx/conf.d/default.conf frontend
```
### Backend Configuration
The only configuration needed to the backend service is an env file, or otherwise
you can directly expose the environmental variables needed, as shown at
[example.dev](backend/envs/example.env)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment