mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-08 08:32:16 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7aeb072cc3 | ||
|
|
8a652761a3 | ||
|
|
be667575d5 | ||
|
|
59ca8a44a0 | ||
|
|
c9f0d3bfd8 |
@@ -20,4 +20,4 @@ jobs:
|
||||
script: make lint
|
||||
- stage: publish
|
||||
if: tag IS present
|
||||
script: make image VERSION=$TRAVIS_TAG && ./scripts/publish.sh $TRAVIS_TAG $DOCKER_USER $DOCKER_PASS
|
||||
script: ./scripts/publish.sh $TRAVIS_TAG $DOCKER_USER $DOCKER_PASS
|
||||
@@ -15,7 +15,7 @@ At TheCodingMachine, we build a lot of web applications (intranets, extranets an
|
||||
* Performance :zap:: Google Chrome and Libreoffice (unoconv) started once in the background thanks to PM2
|
||||
* Failure prevention :broken_heart:: PM2 automatically restarts previous processes if they fail
|
||||
* Assets :package:: send your header, footer, images, fonts, stylesheets and so on for converting your HTML and Markdown to beaufitul PDFs!
|
||||
* Easily interact with the API using our [Go](/pkg) and [PHP](https://github.com/thecodingmachine/gotenberg-php-client) libraries
|
||||
* Easily interact with the API using our [Go](/pkg) and [PHP](https://github.com/thecodingmachine/gotenberg-php-client) (**WIP**) libraries
|
||||
|
||||
## Quick start
|
||||
|
||||
|
||||
@@ -25,22 +25,25 @@ func merge(c echo.Context) error {
|
||||
return fmt.Errorf("getting result file name: %v", err)
|
||||
}
|
||||
filename := fmt.Sprintf("%s.pdf", baseFilename)
|
||||
dest := fmt.Sprintf("%s/%s", r.dirPath, filename)
|
||||
fpath := fmt.Sprintf("%s/%s", r.dirPath, filename)
|
||||
if r.webhookURL() == "" {
|
||||
// if no webhook URL given, run merge
|
||||
// and directly return the resulting PDF file
|
||||
// or and error.
|
||||
return printer.Merge(fpaths, dest)
|
||||
if err := printer.Merge(fpaths, fpath); err != nil {
|
||||
return err
|
||||
}
|
||||
return c.Attachment(fpath, filename)
|
||||
}
|
||||
// as a webhook URL has been given, we
|
||||
// run the following lines in a goroutine so that
|
||||
// it doesn't block.
|
||||
go func() {
|
||||
if err := printer.Merge(fpaths, dest); err != nil {
|
||||
if err := printer.Merge(fpaths, fpath); err != nil {
|
||||
c.Logger().Errorf("%v", err)
|
||||
return
|
||||
}
|
||||
f, err := os.Open(dest)
|
||||
f, err := os.Open(fpath)
|
||||
if err != nil {
|
||||
c.Logger().Errorf("%v", err)
|
||||
return
|
||||
|
||||
@@ -23,7 +23,7 @@ func Merge(fpaths []string, destination string) error {
|
||||
|
||||
func writeBytesToFile(dst string, b []byte) error {
|
||||
if err := ioutil.WriteFile(dst, b, 0644); err != nil {
|
||||
return fmt.Errorf("%s: writting file: %v", dst, err)
|
||||
return fmt.Errorf("%s: writing file: %v", dst, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ func multipartForm(req Request) (*bytes.Buffer, string, error) {
|
||||
}
|
||||
for name, value := range req.getFormValues() {
|
||||
if err := writer.WriteField(name, value); err != nil {
|
||||
return nil, "", fmt.Errorf("%s: writting form field: %v", name, err)
|
||||
return nil, "", fmt.Errorf("%s: writing form field: %v", name, err)
|
||||
}
|
||||
}
|
||||
return body, writer.FormDataContentType(), nil
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
GOLANG_VERSION=1.11.2
|
||||
VERSION="$1"
|
||||
DOCKER_USER="$2"
|
||||
DOCKER_PASSWORD="$3"
|
||||
@@ -16,6 +17,15 @@ if [ $VERSION_LENGTH -ne 3 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
docker push thecodingmachine/gotenberg:${SEMVER[0]}
|
||||
docker push thecodingmachine/gotenberg:${SEMVER[0]}.${SEMVER[1]}
|
||||
docker push thecodingmachine/gotenberg:${SEMVER[0]}.${SEMVER[1]}.${SEMVER[2]}
|
||||
docker build -t thecodingmachine/gotenberg:base -f build/base/Dockerfile .
|
||||
docker build \
|
||||
--build-arg GOLANG_VERSION=${GOLANG_VERSION} \
|
||||
--build-arg VERSION=${VERSION} \
|
||||
-t thecodingmachine/gotenberg:${SEMVER[0]} \
|
||||
-t thecodingmachine/gotenberg:${SEMVER[0]}.${SEMVER[1]} \
|
||||
-t thecodingmachine/gotenberg:${SEMVER[0]}.${SEMVER[1]}.${SEMVER[2]} \
|
||||
-f build/package/Dockerfile .
|
||||
|
||||
docker push "thecodingmachine/gotenberg:${SEMVER[0]}"
|
||||
docker push "thecodingmachine/gotenberg:${SEMVER[0]}.${SEMVER[1]}"
|
||||
docker push "thecodingmachine/gotenberg:${SEMVER[0]}.${SEMVER[1]}.${SEMVER[2]}"
|
||||
Reference in New Issue
Block a user