Dockerfile
FROM node:14.19.0
RUN mkdir -p /app
WORKDIR /app
ADD . /app/
RUN rm yarn.lock || true
RUN rm package-lock.json || true
RUN yarn
RUN yarn build
ENV HOST 0.0.0.0
EXPOSE 3000
CMD [ "yarn", "start"]
.dockerignore
node_modules/
dist/
docker build --tag lucetre.xyz:0.0.1 .
docker run --name lucetre.xyz -d -p 3000:3000 lucetre.xyz:0.0.1
chmod 400 lucetre.pem
ssh -i "lucetre.pem" ec2-user@ec2-3-39-237-30.ap-northeast-2.compute.amazonaws.com
- Follow the linux guidelines.
- Enter any additional labels:
label-go
- [ec2]
nohup ./run.sh &
- [ec2]
tail -f nohup.out
@ IP_ADDR
www IP_ADDR
- https://dnschecker.org/#A/lucetre.xyz
http://lucetre.xyz/
ssh -i "lucetre.pem" ec2-user@lucetre.xyz
amazon-linux-extras list | grep nginx
sudo amazon-linux-extras install -y nginx1
nginx -v
sudo systemctl start nginx
vim /etc/nginx/conf.d/your-site.conf
server { listen 80; server_name nextjs.your-site.com; location / { proxy_pass http://127.0.0.1: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; proxy_set_header X-Forwarded-Proto $scheme; } }
sudo systemctl restart nginx
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum-config-manager --enable epel*
sudo yum install certbot python2-certbot-nginx -y
sudo certbot --nginx
crontab -e
0 12 * * * /usr/bin/certbot renew --quiet
cd actions-runner
nohup ./run.sh &
tail -f nohup.out
sudo systemctl start nginx
sudo certbot --nginx