Comments (6)
STEP 1
$ vi pull.sh
#!/bin/bash
echo "start pull-->"
date "+%Y-%m-%d %H:%M:%S"
cd /var/www/html
git pull
echo "<--end pull"
from hyunsungjoo.github.io.
STEP 2
$ vi blog-pull-cronjob
* * * * * sh /var/www/html/pull.sh >> /var/log/pull.log 2>&1
# new crontab file is missing newline before EOF, can't install.
$ sudo cp blog-pull-cronjob /etc/cron.d
$ sudo crontab /etc/cron.d/blog-pull-cronjob
$ crontab -l
from hyunsungjoo.github.io.
STEP 3
Dockerfile 생성
$ vi Dockerfile
FROM ubuntu:22.04
RUN apt update
RUN apt install -y nginx
RUN apt install -y git
RUN apt install cron
RUN rm -rf /var/www/html
RUN git clone https://github.com/hyunsungJoo/hyunsungJoo.github.io.git /var/www/html
COPY pull.sh /var/www/html
COPY blog-pull-cronjob /etc/cron.d/
RUN crontab /etc/cron.d/blog-pull-cronjob
RUN chmod +x /var/www/html/pull.sh
CMD service cron start && nginx -g 'daemon off;'
from hyunsungjoo.github.io.
STEP 5
Build, Run
$ sudo docker build -t my-f:2 .
$ sudo docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
my-f 2 84c29316c287 7 minutes ago 367MB
$ sudo docker run -itd --name my-f-2 -p 9002:80 my-f:2
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
8d440c4fd4cd my-f:2 "/bin/sh -c 'service…" 7 minutes ago Up 7 minutes 0.0.0.0:9002->80/tcp, :::9002->80/tcp my-f-2
$ sudo docker exec -it my-f-2 bash
root@8d440c4fd4cd:/# service cron status
* cron is running
# 실행중이지 않으면 service cron start으로 실행시킴
root@8d440c4fd4cd:/# crontab -l
* * * * * sh /var/www/html/pull.sh >> /var/log/pull.log 2>&1
# new crontab file is missing newline before EOF, can't install.
from hyunsungjoo.github.io.
local 테스트
github 레포 main의 index.html 변경 전
github 레포 main의 index.html 변경 후
from hyunsungjoo.github.io.
fly.io 배포 테스트
$ flyctl launch
$ vi fly.toml
# fly.toml app configuration file generated for fly240215 on 2024-02-16T15:34:29+09:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = 'fly240215'
primary_region = 'nrt'
[build]
[http_service]
internal_port = 80
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ['app']
[[vm]]
cpu_kind = 'shared'
cpus = 1
memory_mb = 256
github 레포 main의 index.html 변경 전
github 레포 main의 index.html 변경 후
from hyunsungjoo.github.io.
Related Issues (5)
- 네이버 검색 최적화 간단체크 가이드 적용 HOT 2
- 구글 서치콘솔 가이드 적용 HOT 2
- 무중단 배포 만들어 보기 HOT 1
- Docker compose HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hyunsungjoo.github.io.