From ee4a8d4c9b1f82bab629b997556890b82a9479ce Mon Sep 17 00:00:00 2001 From: Tara Wilson Date: Wed, 11 Dec 2024 14:09:48 -0500 Subject: [PATCH] Production scripts --- build-production.sh | 14 +++++++------- source/ticketAPI/Dockerfile | 5 +++++ source/ticketUI/Dockerfile | 4 ++++ source/ticketUI/nginx.conf | 16 ++++++++++++++++ 4 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 source/ticketAPI/Dockerfile create mode 100644 source/ticketUI/Dockerfile create mode 100644 source/ticketUI/nginx.conf diff --git a/build-production.sh b/build-production.sh index 4b7dab1..e363ffd 100644 --- a/build-production.sh +++ b/build-production.sh @@ -9,37 +9,37 @@ git checkout -b release/"$VERSION_NUMBER" #UPDATE PACKAGE FILE echo "Updating Angular App Version" -cd source/ticketUI || exit +cd ./source/ticketUI || exit jq '."version" = "'"$VERSION_NUMBER"'"' package.json > package."$VERSION_NUMBER".json mv package."$VERSION_NUMBER".json package.json #BUILD API echo "Building API:" "$VERSION_NUMBER" -cd source/ticketAPI || exit +cd ./source/ticketAPI || exit dotnet publish -c release -o artifacts /p:DebugType=None /p:DebugSymbols=false cd .. #BUILD UI echo "Building UI:" "$VERSION_NUMBER" -cd source/ticketUI || exit +cd ./source/ticketUI || exit ng build --configuration=production cd .. #PACKAGEING API echo "Creating Docker Container for API" -cd source/ticketAPI || exit +cd ./source/ticketAPI || exit docker buildx create --name apibuilder-"$VERSION_NUMBER" --driver docker-container --bootstrap --use docker buildx build --platform linux/amd64,linux/arm64 --push -t terralilly85/follicle-api:"$VERSION_NUMBER" . cd .. #PACKAGING UI echo "Creating Docker Container for UI" -cd source/ticketUI || exit +cd ./source/ticketUI || exit docker buildx create --name uibuilder-"$VERSION_NUMBER" --driver docker-container --bootstrap --use docker buildx build --platform linux/amd64,linux/arm64 --push -t terralilly85/follicle-ui:"$VERSION_NUMBER" . cd .. #CLEAN UP ARTIFACTS echo "Cleaning up artifacts" -rm -r source/ticketAPI/artifacts -rm -r source/ticketUI/dist \ No newline at end of file +rm -r ./source/ticketAPI/artifacts +rm -r ./source/ticketUI/dist \ No newline at end of file diff --git a/source/ticketAPI/Dockerfile b/source/ticketAPI/Dockerfile new file mode 100644 index 0000000..bb5cb8c --- /dev/null +++ b/source/ticketAPI/Dockerfile @@ -0,0 +1,5 @@ +FROM mcr.microsoft.com/dotnet/aspnet:9.0 +COPY artifacts /app +WORKDIR /app +EXPOSE 80 +ENTRYPOINT ["dotnet", "follicleAPI.dll"] \ No newline at end of file diff --git a/source/ticketUI/Dockerfile b/source/ticketUI/Dockerfile new file mode 100644 index 0000000..951f4e3 --- /dev/null +++ b/source/ticketUI/Dockerfile @@ -0,0 +1,4 @@ +FROM nginx:latest +COPY ./nginx.conf /etc/nginx/conf.d/default.conf +COPY dist /usr/share/nginx/html +EXPOSE 80 \ No newline at end of file diff --git a/source/ticketUI/nginx.conf b/source/ticketUI/nginx.conf new file mode 100644 index 0000000..1aa763b --- /dev/null +++ b/source/ticketUI/nginx.conf @@ -0,0 +1,16 @@ +server { + listen 80; + server_name localhost; + + location / { + root /usr/share/nginx/html; + try_files $uri $uri/ /index.html; + index index.html index.htm; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + +} \ No newline at end of file