[Added] Docker compose, Gitea workflows, production to Dockerfile, Nginx conf

This commit is contained in:
Ninjaws
2024-11-22 14:40:34 +01:00
parent 007c3dd588
commit 176ab06ca8
5 changed files with 60 additions and 12 deletions
+14
View File
@@ -0,0 +1,14 @@
name: Portfolio App Deployment
run-name: ${{ gitea.actor }} is deploying Portfolio App
on:
push:
branches:
- main
jobs:
Portfolio Runner:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v4
- run: docker compose up -d --build
+13
View File
@@ -0,0 +1,13 @@
name: Portfolio App Testing
run-name: ${{ gitea.actor }} is testing Portfolio App
on: [push]
jobs:
Portfolio Runner:
runs-on: ubuntu-latest
steps:
- run: docker --version
- run: docker compose version
- name: Check out repository code
uses: actions/checkout@v4
# Run tests
+11 -12
View File
@@ -13,20 +13,19 @@ RUN apt-get update && \
# If root adds files, it takes ownership, making them unremovable on the host except by using sudo # If root adds files, it takes ownership, making them unremovable on the host except by using sudo
# node tranfers ownership to the host user # node tranfers ownership to the host user
USER node USER node
# EXPOSE 4200
CMD ["tail","-f","/dev/null"] CMD ["tail","-f","/dev/null"]
#--- Building #--- Building
# FROM base AS build FROM base AS build
# COPY package*.json ./ COPY package*.json ./
# RUN npm install RUN npm install
# # Copied here, since the the Development setup uses a bind volume instead # Copied here, since the the Development setup uses a bind volume instead
# COPY . . COPY . .
# RUN ng build --configuration production RUN ng build --configuration production
#--- Production #--- Production
# FROM nginx:alpine AS production FROM nginx:alpine AS production
# COPY --from=build /app/dist/quiz/browser /usr/share/nginx/html COPY --from=build /app/dist/portfolio/browser /usr/share/nginx/html
# COPY nginx.conf /etc/nginx/conf.d/default.conf COPY nginx.conf /etc/nginx/conf.d/default.conf
# EXPOSE 80 EXPOSE 80
# CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]
+13
View File
@@ -0,0 +1,13 @@
services:
frontend:
build:
context: .
dockerfile: Dockerfile
target: production
image: website-frontend-prod
container_name: website-frontend-prod-cont
ports:
- "4400:80"
restart: always
cpu_period: 100000 # Default is 100,000 microseconds (100ms)
cpu_quota: 5000 # 5% of the total CPU time
+9
View File
@@ -0,0 +1,9 @@
server {
listen 80;
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
}