IBM Code Engine 및 정적 휴고 사이트
5080 단어 tutorialserverlessibm
범위
이것은 IBM Cloud에서 hugo과 작업하기 위해 code-engine을 가져오는 튜토리얼/데모입니다.
전제 조건
hugo
사이트를 푸시할 수 있는 GitHub 저장소를 만듭니다. 단계
휴고 정적 사이트 생성기
code-engine-hugo
는 예제 이름일 뿐입니다.$ hugo new site code-engine-hugo
Congratulations! Your new Hugo site is created in /code-engine-hugo.
Just a few more steps and you're ready to go:
2. Download a theme into the same-named folder.
Choose a theme from https://themes.gohugo.io/ or
create your own with the "hugo new theme <THEMENAME>" command.
3. Perhaps you want to add some content. You can add single files
with "hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>".
4. Start the built-in live server via "hugo server".
Visit https://gohugo.io/ for quickstart guide and full documentation.
git
저장소를 만들고 다음 지침을 따르십시오.$ cd /code-engine-hugo
$ git init
$ git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke
$ echo theme = \"ananke\" >> config.toml
$ hugo new posts/my-first-post.md
$ vim content/posts/my-first-post.md # just fill it with dummy text
$ hugo server -D
"My New Hugo Site"라고 적힌 사이트를 볼 수 있어야 합니다.
my-first-post.md
에는 draft: true
가 있습니다. 실제로 변경하려면 false
로 변경하십시오.이제 게시물을 변경하거나 추가할 때 초안 없이
hugo
를 실행할 수 있으며 새 사이트가 해당 디렉토리의 public/
에 다시 생성됩니다.새 사이트를 GitHub 리포지토리로 푸시하고 Dockerfile을 생성하면 다음으로 코드 엔진 구성을 시작합니다.
$ cd /code-engine-hugo
$ cat << EOF >> Dockerfile [45/104]
FROM klakegg/hugo:latest
ADD . /src
EXPOSE 8080
ENTRYPOINT ["hugo", "server", "--port", "8080"]
EOF
$ git add .
$ git commit -m "inital commit"
$ git push origin main
$ docker build -t jjasghar/code-engine-hugo-example .
$ docker run -it --rm -p 8080:8080 jjasghar/code-engine-hugo-example:latest server
Start building sites …
| EN
------------------------+-----
Pages | 7
Paginator pages | 0
Non-page files | 0
Static files | 1
Processed images | 0
Aliases | 0
Sitemaps | 1
Cleaned | 0
Built in 23 ms
Watching for changes in /src/{archetypes,content,data,layouts,static,themes}
Watching for config changes in /src/config.toml, /src/themes/ananke/config.yaml
Environment: "DEV"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 0.0.0.0)
Press Ctrl+C to stop
# In another terminal/webbrowser:
$ open localhost:8080
코드 엔진 서버리스 플랫폼
이제 GitHub에 리포지토리가 있으므로 IBM Cloud 콘솔에 로그인합니다.

[개요][codeengine-개요] 페이지로 이동해야 합니다.

이제 위에서 리포지토리를 가져와서 "소스 코드로 시작"입력 상자에 추가합니다.

아직 프로젝트를 만들지 않았다면 내가 가리키는 곳에 프로젝트를 만들거나 내가 "jjtesting"으로 가지고 있는 것과 같은 것을 선택하십시오.

아래로 스크롤하여 "Specifiy build details"를 클릭하고 루트 디렉터리로
/
를 입력합니다. hugo
는 config.toml
파일을 찾을 수 있어야 합니다.Dockerfile
를 볼 수 있는지 확인하고 자격 증명을 Docker 허브에 추가해야 합니다. 그러면 리포지토리가 생성되고 이 컨테이너가 여기에 푸시됩니다."완료"및 "만들기"를 클릭합니다.
이제 애플리케이션 URL을 열면
hugo
사이트가 있어야 합니다!
Reference
이 문제에 관하여(IBM Code Engine 및 정적 휴고 사이트), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/jjasghar/ibm-code-engine-and-static-hugo-site-46o5텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)