-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
68 additions
and
0 deletions.
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,34 @@ | ||
variables: | ||
WKHTMLTOPDF_VERSION: "0.12.6" | ||
|
||
# explicit tag to be used within pipeline | ||
BUILD_IMAGE_NAME: "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:$CI_COMMIT_SHA" | ||
|
||
# we also publish a floating tag to simplify manual testing | ||
BUILD_IMAGE_NAME_LATEST: "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG:latest" | ||
|
||
build: | ||
image: docker:20.10.6 | ||
stage: build | ||
services: | ||
- name: docker:20.10.6-dind | ||
|
||
before_script: | ||
- | | ||
for i in $(seq 1 30); do | ||
if ! docker info &> /dev/null; then | ||
echo "Docker not responding yet. Sleeping for 2s..." && sleep 2s | ||
else | ||
echo "Docker ready. Continuing build..." | ||
break | ||
fi | ||
done | ||
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" | ||
script: | ||
- docker build | ||
-f Dockerfile-${WKHTMLTOPDF_VERSION} | ||
--tag "$BUILD_IMAGE_NAME" | ||
--tag "$BUILD_IMAGE_NAME_LATEST" | ||
. | ||
- docker push "$BUILD_IMAGE_NAME" | ||
- docker push "$BUILD_IMAGE_NAME_LATEST" |
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,30 @@ | ||
# first stage: build kwkhtmltopdf_server | ||
|
||
FROM golang:1.11 | ||
WORKDIR /tmp | ||
COPY server/kwkhtmltopdf_server.go . | ||
RUN go build kwkhtmltopdf_server.go | ||
|
||
# second stage: server with wkhtmltopdf | ||
|
||
FROM ubuntu:18.04 | ||
|
||
RUN set -x \ | ||
&& apt update \ | ||
&& apt -y install --no-install-recommends curl ca-certificates fonts-liberation2 \ | ||
&& curl -o /tmp/wkhtmltox.deb -SL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb \ | ||
&& echo "3a9a5619d9b423103cabd316ed9634e1c71d4504 /tmp/wkhtmltox.deb" | sha1sum -c - \ | ||
&& apt -y install /tmp/wkhtmltox.deb \ | ||
&& apt -y purge wget --autoremove \ | ||
&& apt -y clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=0 /tmp/kwkhtmltopdf_server /usr/local/bin/ | ||
|
||
RUN adduser --disabled-password --gecos '' kwkhtmltopdf | ||
USER kwkhtmltopdf | ||
ENV LANG C.UTF-8 | ||
ENV LC_ALL C.UTF-8 | ||
|
||
EXPOSE 8080 | ||
CMD /usr/local/bin/kwkhtmltopdf_server |
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