https://github.com/artemtech/docker-hugo-deployer
Hugo deploy to your server using rsync
https://github.com/artemtech/docker-hugo-deployer
Last synced: 3 months ago
JSON representation
Hugo deploy to your server using rsync
- Host: GitHub
- URL: https://github.com/artemtech/docker-hugo-deployer
- Owner: artemtech
- Created: 2023-11-02T00:42:42.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-11-02T01:18:23.000Z (over 2 years ago)
- Last Synced: 2025-02-21T10:36:52.266Z (over 1 year ago)
- Language: Dockerfile
- Homepage: https://hub.docker.com/r/artemtech/hugo-deployer
- Size: 5.86 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# docker-hugo-deployer
[](https://hub.docker.com/r/artemtech/hugo-deployer)
[](https://hub.docker.com/r/artemtech/hugo-deployer)
Hugo deploy to your server using rsync
## configs
| environment name | value | default|
|---|---|---|
|`KIND`|`build` or `deploy`|`build`|
|`DEPLOY_TYPE`|`local` or `ssh`|`local`|
|`DEPLOY_DESTINATION`|`/var/www/html/`|`/var/www/html/`|
|`DEPLOY_PORT`|`22`|`22`|
|`SSH_KEY`|`base64 of your ssh key content`|none|
|`WORKING_DIR`|`/src`|`/src`|
If using `DEPLOY_TYPE=ssh`, set `DEPLOY_DESTINATION` to `username@host-target:/your/destination/path`.
If you are using ci/cd service like gitlab-ci or github-action, WORKING_DIR is set to `$CI_PROJECT_DIR`.
If you are building your site locally, you can bind mount your project to /src inside container, and bind mount your desired destination folder as you defined in DEPLOY_DESTINATION environment. For example:
```bash
# build
docker run --rm -dti -e DEPLOY_TYPE=local \
-e KIND=build \
-e DEPLOY_DESTINATION=/destination \
-v /home/artemtech/hugo-site-src:/src \
-v /home/artemtech/blog:/destination \
artemtech/hugo-deployer
# deploy
docker run --rm -dti -e DEPLOY_TYPE=local \
-e KIND=deploy \
-e DEPLOY_DESTINATION=/destination \
-v /home/artemtech/hugo-site-src:/src \
-v /home/artemtech/blog:/destination \
artemtech/hugo-deployer
```
## usage in gitlab-ci
```
stages:
- build
- deploy
variables:
GIT_SUBMODULE_STRATEGY: recursive
build-and-test:
stage: build
image: artemtech/hugo-deployer
variables:
KIND: build
script:
- hugo-builder
artifacts:
paths:
- public
go-to-production:
stage: deploy
image: artemtech/hugo-deployer
when: manual
variables:
KIND: deploy
DEPLOY_TYPE: ssh
SSH_KEY: $SSH_DEPLOY_KEY
before_script:
- mkdir -p ~/.ssh
- 'which ssh-agent || ( apk add --update openssh )'
- eval "$(ssh-agent -s)"
- echo "${SSH_KEY}" | tr -d ' ' | base64 -d | ssh-add -
script:
- hugo-builder
```