mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-15 11:52:14 +01:00
preparing mardown file handling in Dockerfiles + refactoring build directory
This commit is contained in:
@@ -17,6 +17,17 @@ RUN echo "deb http://httpredir.debian.org/debian/ stretch main contrib non-free"
|
|||||||
ln -s /usr/bin/pdftk /usr/local/bin/pdftk &&\
|
ln -s /usr/bin/pdftk /usr/local/bin/pdftk &&\
|
||||||
ln -s /usr/bin/unoconv /usr/local/bin/unoconv
|
ln -s /usr/bin/unoconv /usr/local/bin/unoconv
|
||||||
|
|
||||||
|
RUN apt-get install -y curl gnupg &&\
|
||||||
|
curl -sL https://deb.nodesource.com/setup_8.x | bash - &&\
|
||||||
|
apt-get update &&\
|
||||||
|
apt-get install -y nodejs
|
||||||
|
|
||||||
|
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - &&\
|
||||||
|
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list &&\
|
||||||
|
apt-get update &&\
|
||||||
|
apt-get install -y yarn bzip2 &&\
|
||||||
|
yarn global add markdown-pdf --prefix /usr/local
|
||||||
|
|
||||||
# |--------------------------------------------------------------------------
|
# |--------------------------------------------------------------------------
|
||||||
# | Gotenberg
|
# | Gotenberg
|
||||||
# |--------------------------------------------------------------------------
|
# |--------------------------------------------------------------------------
|
||||||
@@ -41,11 +52,11 @@ RUN go get -d -v ./...
|
|||||||
ENTRYPOINT [".ci/docker-entrypoint.sh"]
|
ENTRYPOINT [".ci/docker-entrypoint.sh"]
|
||||||
{{- else }}
|
{{- else }}
|
||||||
|
|
||||||
COPY .build/gotenberg /usr/bin/gotenberg
|
COPY .ci/gotenberg /usr/bin/gotenberg
|
||||||
RUN ln -s /usr/bin/gotenberg /usr/local/bin/gotenberg
|
RUN ln -s /usr/bin/gotenberg /usr/local/bin/gotenberg
|
||||||
|
|
||||||
WORKDIR /gotenberg
|
WORKDIR /gotenberg
|
||||||
COPY .build/gotenberg.yml /gotenberg/gotenberg.yml
|
COPY .ci/gotenberg.yml /gotenberg/gotenberg.yml
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
CMD ["gotenberg"]
|
CMD ["gotenberg"]
|
||||||
|
|||||||
BIN
.build/gotenberg
BIN
.build/gotenberg
Binary file not shown.
@@ -22,7 +22,7 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Builds the Linux binary.
|
# Builds the Linux binary.
|
||||||
env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION}" && mv gotenberg .build/;
|
env GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-X main.version=${VERSION}" && mv gotenberg .ci/;
|
||||||
|
|
||||||
# Bye!
|
# Bye!
|
||||||
exit 0;
|
exit 0;
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
.ci/coverage.txt
|
.ci/coverage.txt
|
||||||
|
.ci/gotenberg
|
||||||
.vscode
|
.vscode
|
||||||
15
Dockerfile
15
Dockerfile
@@ -17,6 +17,17 @@ RUN echo "deb http://httpredir.debian.org/debian/ stretch main contrib non-free"
|
|||||||
ln -s /usr/bin/pdftk /usr/local/bin/pdftk &&\
|
ln -s /usr/bin/pdftk /usr/local/bin/pdftk &&\
|
||||||
ln -s /usr/bin/unoconv /usr/local/bin/unoconv
|
ln -s /usr/bin/unoconv /usr/local/bin/unoconv
|
||||||
|
|
||||||
|
RUN apt-get install -y curl gnupg &&\
|
||||||
|
curl -sL https://deb.nodesource.com/setup_8.x | bash - &&\
|
||||||
|
apt-get update &&\
|
||||||
|
apt-get install -y nodejs
|
||||||
|
|
||||||
|
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - &&\
|
||||||
|
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list &&\
|
||||||
|
apt-get update &&\
|
||||||
|
apt-get install -y yarn bzip2 &&\
|
||||||
|
yarn global add markdown-pdf --prefix /usr/local
|
||||||
|
|
||||||
# |--------------------------------------------------------------------------
|
# |--------------------------------------------------------------------------
|
||||||
# | Gotenberg
|
# | Gotenberg
|
||||||
# |--------------------------------------------------------------------------
|
# |--------------------------------------------------------------------------
|
||||||
@@ -24,11 +35,11 @@ RUN echo "deb http://httpredir.debian.org/debian/ stretch main contrib non-free"
|
|||||||
# | All Gotenberg related stuff.
|
# | All Gotenberg related stuff.
|
||||||
# |
|
# |
|
||||||
|
|
||||||
COPY .build/gotenberg /usr/bin/gotenberg
|
COPY .ci/gotenberg /usr/bin/gotenberg
|
||||||
RUN ln -s /usr/bin/gotenberg /usr/local/bin/gotenberg
|
RUN ln -s /usr/bin/gotenberg /usr/local/bin/gotenberg
|
||||||
|
|
||||||
WORKDIR /gotenberg
|
WORKDIR /gotenberg
|
||||||
COPY .build/gotenberg.yml /gotenberg/gotenberg.yml
|
COPY .ci/gotenberg.yml /gotenberg/gotenberg.yml
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
CMD ["gotenberg"]
|
CMD ["gotenberg"]
|
||||||
@@ -17,6 +17,17 @@ RUN echo "deb http://httpredir.debian.org/debian/ stretch main contrib non-free"
|
|||||||
ln -s /usr/bin/pdftk /usr/local/bin/pdftk &&\
|
ln -s /usr/bin/pdftk /usr/local/bin/pdftk &&\
|
||||||
ln -s /usr/bin/unoconv /usr/local/bin/unoconv
|
ln -s /usr/bin/unoconv /usr/local/bin/unoconv
|
||||||
|
|
||||||
|
RUN apt-get install -y curl gnupg &&\
|
||||||
|
curl -sL https://deb.nodesource.com/setup_8.x | bash - &&\
|
||||||
|
apt-get update &&\
|
||||||
|
apt-get install -y nodejs
|
||||||
|
|
||||||
|
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - &&\
|
||||||
|
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list &&\
|
||||||
|
apt-get update &&\
|
||||||
|
apt-get install -y yarn bzip2 &&\
|
||||||
|
yarn global add markdown-pdf --prefix /usr/local
|
||||||
|
|
||||||
# |--------------------------------------------------------------------------
|
# |--------------------------------------------------------------------------
|
||||||
# | Gotenberg
|
# | Gotenberg
|
||||||
# |--------------------------------------------------------------------------
|
# |--------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ const (
|
|||||||
// filesTypes associates a file extension with its file kind counterpart.
|
// filesTypes associates a file extension with its file kind counterpart.
|
||||||
var filesTypes = map[string]Type{
|
var filesTypes = map[string]Type{
|
||||||
".pdf": PDFType,
|
".pdf": PDFType,
|
||||||
|
".htm": HTMLType,
|
||||||
".html": HTMLType,
|
".html": HTMLType,
|
||||||
".doc": OfficeType,
|
".doc": OfficeType,
|
||||||
".docx": OfficeType,
|
".docx": OfficeType,
|
||||||
|
|||||||
@@ -114,11 +114,26 @@ func TestConvertHandler(t *testing.T) {
|
|||||||
t.Errorf("Handler returned a wrong status code: got %v want %v", status, http.StatusInternalServerError)
|
t.Errorf("Handler returned a wrong status code: got %v want %v", status, http.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
|
||||||
// case 4: sends a request with two files.
|
// case 3: sends two requests (almost) simultany.
|
||||||
path, _ = filepath.Abs("../_tests/configurations/gotenberg.yml")
|
path, _ = filepath.Abs("../_tests/configurations/gotenberg.yml")
|
||||||
appConfig, _ = config.NewAppConfig(path)
|
appConfig, _ = config.NewAppConfig(path)
|
||||||
process.Load(appConfig.CommandsConfig)
|
process.Load(appConfig.CommandsConfig)
|
||||||
|
|
||||||
|
/*sum := 0
|
||||||
|
for sum < 2 {
|
||||||
|
go func() {
|
||||||
|
path, _ := filepath.Abs("../_tests/file.docx")
|
||||||
|
req := makeRequest(path)
|
||||||
|
rr := httptest.NewRecorder()
|
||||||
|
h.ServeHTTP(rr, req)
|
||||||
|
if status := rr.Code; status != http.StatusInternalServerError {
|
||||||
|
t.Errorf("Handler returned a wrong status code: got %v want %v", status, http.StatusInternalServerError)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
sum++
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// case 4: sends a request with two files.
|
||||||
oPath, _ = filepath.Abs("../_tests/file.docx")
|
oPath, _ = filepath.Abs("../_tests/file.docx")
|
||||||
path, _ = filepath.Abs("../_tests/file.pdf")
|
path, _ = filepath.Abs("../_tests/file.pdf")
|
||||||
req = makeRequest(oPath, path)
|
req = makeRequest(oPath, path)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ tasks:
|
|||||||
short: Runs CI process inside a container
|
short: Runs CI process inside a container
|
||||||
run:
|
run:
|
||||||
- docker build -t gotenberg:ci -f Dockerfile.ci .
|
- docker build -t gotenberg:ci -f Dockerfile.ci .
|
||||||
- docker run --rm -e "VERSION={{ .Orbit.Version }}" -v "$(pwd)/.ci:/go/src/github.com/thecodingmachine/gotenberg/.ci" -v "$(pwd)/.build:/go/src/github.com/thecodingmachine/gotenberg/.build" gotenberg:ci
|
- docker run --rm -e "VERSION={{ .Orbit.Version }}" -v "$(pwd)/.ci:/go/src/github.com/thecodingmachine/gotenberg/.ci" gotenberg:ci
|
||||||
|
|
||||||
- use: build
|
- use: build
|
||||||
short: Builds the main Docker image
|
short: Builds the main Docker image
|
||||||
|
|||||||
Reference in New Issue
Block a user