Compare commits
3 Commits
a980fc5174
...
57c7a44256
| Author | SHA1 | Date | |
|---|---|---|---|
| 57c7a44256 | |||
| e3a13d3b0c | |||
| 252b84daad |
35
.drone.yml
Normal file
35
.drone.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: rc-portfolio-build-deploy
|
||||
|
||||
steps:
|
||||
# Dockerize the Angular app
|
||||
- name: dockerize
|
||||
image: plugins/docker
|
||||
settings:
|
||||
registry: hub.chagarlamudi.net
|
||||
repo: hub.chagarlamudi.net/rc-portfolio
|
||||
tags: latest
|
||||
dockerfile: Dockerfile
|
||||
|
||||
# Deploy the Docker container to the server
|
||||
- name: deploy
|
||||
image: appleboy/drone-ssh
|
||||
settings:
|
||||
host:
|
||||
from_secret: pineapple_gateway
|
||||
port:
|
||||
from_secret: tornado_level
|
||||
username:
|
||||
from_secret: midnight_owl
|
||||
password:
|
||||
from_secret: dragon_scale
|
||||
script:
|
||||
- /usr/local/bin/docker pull hub.chagarlamudi.net/rc-portfolio:latest
|
||||
- /usr/local/bin/docker stop rc-portfolio-container || true # Stop the container if it exists
|
||||
- /usr/local/bin/docker rm rc-portfolio-container || true # Remove the container
|
||||
- /usr/local/bin/docker run -d -p 8080:80 --name rc-portfolio-container hub.chagarlamudi.net/rc-portfolio:latest # Start the container
|
||||
|
||||
when:
|
||||
branch:
|
||||
- main # Trigger this pipeline only for the main branch
|
||||
35
Dockerfile
Normal file
35
Dockerfile
Normal file
@@ -0,0 +1,35 @@
|
||||
# Stage 1: Build the Angular application
|
||||
FROM node:latest AS build-prod
|
||||
|
||||
# Set working directory in the container
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package.json and package-lock.json files for dependency installation
|
||||
COPY package*.json ./
|
||||
|
||||
# Install specific version of Angular CLI globally
|
||||
RUN npm install -g @angular/cli
|
||||
|
||||
# Install project dependencies
|
||||
RUN npm ci
|
||||
|
||||
# Copy the rest of the application files
|
||||
COPY . .
|
||||
|
||||
# Build the Angular application for production
|
||||
RUN npm run build
|
||||
|
||||
# Stage 2: Serve the app with Nginx
|
||||
FROM nginx:latest
|
||||
|
||||
# Copy custom Nginx configuration file
|
||||
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Copy the built Angular application to Nginx's default directory
|
||||
COPY --from=build-prod /app/dist/rc-portfolio/browser /usr/share/nginx/html
|
||||
|
||||
# Expose port 80 to allow access to the app
|
||||
EXPOSE 80
|
||||
|
||||
# Start Nginx to serve the app
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
15
nginx.conf
Normal file
15
nginx.conf
Normal file
@@ -0,0 +1,15 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
# Set the root directory for the application
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
# Default index file
|
||||
index index.html;
|
||||
|
||||
# Handle routes with Angular's HTML5 mode
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user