-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
47 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to GHCR.io | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.TOKEN }} | ||
|
||
- name: Build Docker image | ||
run: | | ||
docker build -t home-zeyx-dev:latest . | ||
docker tag home-zeyx-dev:latest ghcr.io/zeyxs/home-zeyx-dev:latest | ||
- name: Push Docker image to GHCR.io | ||
run: docker push ghcr.io/zeyxs/home-zeyx-dev:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,31 @@ | ||
FROM node:alpine AS builder | ||
# Stage 1: Build the React app with Vite | ||
FROM node:alpine AS build | ||
|
||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json if applicable | ||
COPY package*.json ./ | ||
RUN npm install | ||
|
||
COPY . ./ | ||
# Install dependencies | ||
RUN npm install | ||
|
||
# Copy the rest of the application | ||
COPY . . | ||
|
||
# Build the React app | ||
RUN npm run build | ||
|
||
# Stage 2: Serve the built app using NGINX | ||
FROM nginx:alpine | ||
|
||
FROM nginx:alpine AS production | ||
ENV NODE_ENV=production | ||
# Copy the built app from the previous stage to NGINX directory | ||
COPY --from=build /app/dist /usr/share/nginx/html | ||
|
||
COPY --from=builder /app/dist /usr/share/nginx/html | ||
# Copy custom nginx configuration | ||
COPY nginx.conf /etc/nginx/conf.d/default.conf | ||
|
||
# Expose port 80 | ||
EXPOSE 80 | ||
|
||
CMD ["nginx", "-g", "daemon off;"] | ||
# Start NGINX server | ||
CMD ["nginx", "-g", "daemon off;"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ function App() { | |
); | ||
}; | ||
|
||
export default App; | ||
export default App; |