Skip to content

Commit

Permalink
fix: github flow
Browse files Browse the repository at this point in the history
  • Loading branch information
seokkkkkk committed Jul 17, 2024
1 parent 95fb3cf commit 609feed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 26 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile.prod # Dockerfile.prod 경로 지정
file: ./Dockerfile.prod
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/syluv:latest

Expand All @@ -58,9 +58,9 @@ jobs:
timeout: 60s
script: |
echo "Pulling latest Docker image"
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/syulv
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/syluv:latest
echo "Stopping existing Docker container"
sudo docker stop syluvFrontend || true
sudo docker rm syluvFrontend || true
echo "Starting new Docker container"
sudo docker run -d --rm --name syluvFrontend -p 80:80 -p 443:443 ${{ secrets.DOCKERHUB_USERNAME }}/syluv
sudo docker run -d --rm --name syluvFrontend -p 80:80 ${{ secrets.DOCKERHUB_USERNAME }}/syluv:latest
13 changes: 4 additions & 9 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Stage 1: Build
# Stage 1: Build the React app
FROM node:lts AS build

WORKDIR /app

COPY package.json .
COPY package.json package-lock.json ./

RUN npm install

Expand All @@ -16,18 +16,13 @@ FROM nginx:stable-alpine

# Remove default Nginx configuration and copy custom config
RUN rm -rf /etc/nginx/conf.d
COPY conf /etc/nginx

# Copy SSL certificates
COPY path/to/your/ssl/certificates/nginx.crt /etc/nginx/ssl/nginx.crt
COPY path/to/your/ssl/certificates/nginx.key /etc/nginx/ssl/nginx.key
COPY nginx.conf /etc/nginx/conf.d/default.conf

# Copy built files to Nginx
COPY --from=build /app/build /usr/share/nginx/html

# Expose HTTP and HTTPS ports
# Expose HTTP port
EXPOSE 80
EXPOSE 443

# Run Nginx
CMD ["nginx", "-g", "daemon off;"]
15 changes: 1 addition & 14 deletions conf/conf.d/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,8 @@ server {
listen 80;
server_name syluv.store www.syluv.store;

# HTTP 요청을 HTTPS로 리디렉션
location / {
return 301 https://$host$request_uri;
}
}

server {
listen 443 ssl;
server_name syluv.store www.syluv.store;

ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;

location / {
proxy_pass http://localhost:3000;
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down

0 comments on commit 609feed

Please sign in to comment.