This repository was archived by the owner on Aug 21, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
Add Dockerfile #36
Closed
Closed
Add Dockerfile #36
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
98d1e32
Add Dockerfile
tmaier d7124ea
Set PATH
tmaier 5609938
Add README sections on Docker
tmaier c7032aa
Add docker badges
tmaier 88ae55b
Add badge with the # GitHub stars
tmaier b4ef27f
Significantly reduce the size of the Docker image
tmaier 3120e24
Further improve README [ci skip]
tmaier 4ba1156
Add labels to Dockerfile
tmaier 62a5042
Add whalebrew label
tmaier 7c429a8
Fix image name in one of the labels
tmaier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
FROM node:9.4-alpine | ||
|
||
LABEL \ | ||
io.whalebrew.name="gitlab-le" \ | ||
maintainer="Tobias L. Maier <[email protected]>" \ | ||
org.label-schema.description="CLI Tool to easily generate a Let's Encrypt certificate for GitLab.com hosted pages" \ | ||
org.label-schema.docker.cmd.help="docker container run --rm rolodato/gitlab-letsencrypt --help" \ | ||
org.label-schema.docker.cmd="docker container run --rm rolodato/gitlab-letsencrypt --domain example.com --email [email protected] --repository https://gitlab.com/my-user/my-repo --token GITLAB_TOKEN" \ | ||
org.label-schema.docker.schema-version="1.0" \ | ||
org.label-schema.name="gitlab-letsencrypt" \ | ||
org.label-schema.url="https://github.com/rolodato/gitlab-letsencrypt" \ | ||
org.label-schema.usage="https://github.com/rolodato/gitlab-letsencrypt/blob/master/README.markdown" \ | ||
org.label-schema.vcs-url="https://github.com/rolodato/gitlab-letsencrypt" \ | ||
org.label-schema.vendor="Tobias L. Maier <[email protected]>" | ||
|
||
ENV PATH="/home/node/.npm-global/bin:${PATH}" | ||
ENV NPM_CONFIG_PREFIX=/home/node/.npm-global | ||
|
||
RUN apk add --no-cache --virtual build-dependencies \ | ||
build-base \ | ||
python \ | ||
&& su node -c "npm install --quiet --production --no-progress -g gitlab-letsencrypt" \ | ||
&& apk del build-dependencies | ||
|
||
USER node | ||
|
||
ENTRYPOINT ["gitlab-le"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# gitlab-letsencrypt [](https://travis-ci.org/rolodato/gitlab-letsencrypt) | ||
# gitlab-letsencrypt [](https://travis-ci.org/rolodato/gitlab-letsencrypt) [](https://hub.docker.com/r/rolodato/gitlab-letsencrypt/) [](https://hub.docker.com/r/rolodato/gitlab-letsencrypt/) [](https://github.com/rolodato/gitlab-letsencrypt) | ||
|
||
|
||
Command-line tool to generate a [Let's Encrypt](https://letsencrypt.org) certificate for use with [GitLab Pages](https://pages.gitlab.io/). | ||
|
||
|
@@ -45,6 +46,57 @@ Try it out: https://example.com https://www.example.com (GitLab might take a few | |
This certificate expires on Sat Apr 14 2018 03:09:06 GMT+0100 (BST). You will need to run gitlab-le again at some time before this date. | ||
``` | ||
|
||
## Docker image | ||
|
||
There is also a [Docker image](https://hub.docker.com/r/rolodato/gitlab-letsencrypt/) available. | ||
This means the Command-line tool can be used without installing all the dependencies required to run the application. | ||
|
||
Example: | ||
```text | ||
docker container run --rm -it rolodato/gitlab-letsencrypt \ | ||
--domain example.com \ | ||
--email [email protected] \ | ||
--repository https://gitlab.com/my/repo \ | ||
--jekyll \ | ||
--path /acme-challenge \ | ||
--token $GITLAB_TOKEN | ||
``` | ||
|
||
## Automatic renewal of the certificate | ||
|
||
Let's Encrypt certificates have a comparatively short life-span. | ||
They need to be renewed regularly. | ||
|
||
Use the [GitLab Pipeline Schedule](https://docs.gitlab.com/ce/user/project/pipelines/schedules.html) feature to automate the renewal process. | ||
|
||
```yaml | ||
ssl:renew certificate: | ||
image: | ||
name: rolodato/gitlab-letsencrypt | ||
entrypoint: ["/bin/sh", "-c"] | ||
variables: | ||
GIT_STRATEGY: none | ||
before_script: [] | ||
script: |- | ||
gitlab-le \ | ||
--domain example.com \ | ||
--email $LETS_ENCRYPT_EMAIL \ | ||
--jekyll \ | ||
--path /acme-challenge \ | ||
--production \ | ||
--repository $CI_PROJECT_URL \ | ||
--token $GITLAB_TOKEN | ||
only: | ||
- schedules | ||
``` | ||
|
||
Add the following variables to your GitLab project: `LETS_ENCRYPT_EMAIL` and your secret `GITLAB_TOKEN`. | ||
|
||
Consider to add `except: [schedules]` to all other jobs in your `.gitlab-ci.yml` file, as they will be anyway triggered when gitlab-le adds and removes the ACME challenge. | ||
|
||
Schedule then a new pipeline to run for example every month. | ||
See <https://docs.gitlab.com/ce/user/project/pipelines/schedules.html> for details. | ||
|
||
## How it works | ||
|
||
`gitlab-le` uses the [ACME HTTP Challenge](https://tools.ietf.org/html/draft-ietf-acme-acme-09#section-8.3) to prove ownership of a given set of domains. | ||
|
@@ -77,4 +129,4 @@ However, GitLab does not provide a way to automatically renew certificates, so t | |
|
||
## Automation | ||
|
||
Since 10.2, GitLab provides an API to configure HTTPS certificates on a GitLab page, which means `gitlab-le` can be configured to obtain new certificates when your existing ones are about to expire. | ||
Since 10.2, GitLab provides an API to configure HTTPS certificates on a GitLab page, which means `gitlab-le` can be configured to obtain new certificates when your existing ones are about to expire. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you leave a newline here? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean? I think there is a newline due to the code block following this line