Skip to content

Commit

Permalink
Merge branch 'prebuild-docker-images' into 'main'
Browse files Browse the repository at this point in the history
Prebuild docker images

See merge request reportcreator/reportcreator!676
  • Loading branch information
aronmolnar committed Aug 29, 2024
2 parents 6d141e8 + 8837d0d commit 42035b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
19 changes: 6 additions & 13 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ build-test-api:
for img in rendering api-dev; do
if ! docker manifest inspect $CI_REGISTRY_IMAGE/$img:$ISO_WEEK > /dev/null; then
docker buildx build --provenance false --build-arg BUILDKIT_INLINE_CACHE=1 --no-cache --pull --target=$img --platform linux/amd64,linux/arm64 --push -t $CI_REGISTRY_IMAGE/$img:$ISO_WEEK .
else
docker buildx build --provenance false --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $CI_REGISTRY_IMAGE/rendering:$ISO_WEEK --cache-from $CI_REGISTRY_IMAGE/api-dev:$ISO_WEEK --target=$img --platform linux/amd64,linux/arm64 --push -t $CI_REGISTRY_IMAGE/$img:$ISO_WEEK .
fi
done
- docker buildx build --provenance false --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $CI_REGISTRY_IMAGE/rendering:$ISO_WEEK --cache-from $CI_REGISTRY_IMAGE/api-dev:$ISO_WEEK --target=api-test --platform linux/amd64,linux/arm64 --push -t $CI_REGISTRY_IMAGE/api-test:$CI_COMMIT_SHORT_SHA .
Expand All @@ -113,6 +115,8 @@ build-test-frontend:
for img in pdfviewer-dev frontend-dev; do
if ! docker manifest inspect $CI_REGISTRY_IMAGE/$img:$ISO_WEEK > /dev/null; then
docker buildx build --provenance false --build-arg BUILDKIT_INLINE_CACHE=1 --no-cache --pull --target=$img --platform linux/amd64,linux/arm64 --push -t $CI_REGISTRY_IMAGE/$img:$ISO_WEEK .
else
docker buildx build --provenance false --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $CI_REGISTRY_IMAGE/pdfviewer-dev:$ISO_WEEK --cache-from $CI_REGISTRY_IMAGE/frontend-dev:$ISO_WEEK --target=$img --platform linux/amd64,linux/arm64 --push -t $CI_REGISTRY_IMAGE/$img:$ISO_WEEK .
fi
done
- docker buildx build --provenance false --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $CI_REGISTRY_IMAGE/pdfviewer-dev:$ISO_WEEK --cache-from $CI_REGISTRY_IMAGE/frontend-dev:$ISO_WEEK --target=frontend-test --platform linux/amd64,linux/arm64 --push -t $CI_REGISTRY_IMAGE/frontend-test:$CI_COMMIT_SHORT_SHA .
Expand Down Expand Up @@ -183,22 +187,11 @@ build-release:
- docker buildx build --provenance false --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $CI_REGISTRY_IMAGE/languagetool:$CACHE_RELEASE_TAG --platform linux/amd64,linux/arm64 --push -t $CI_REGISTRY_IMAGE/languagetool:$CI_COMMIT_TAG .
- cd ..
- export VERSION_NUMBER
- docker buildx build --provenance false --build-arg BUILDKIT_INLINE_CACHE=1 --build-arg VERSION="$VERSION_NUMBER" --cache-from $CI_REGISTRY_IMAGE/api-test:$CACHE_RELEASE_TAG --target=api --platform linux/amd64,linux/arm64 --push --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG .

release-docker-internal:
stage: release
extends: .depends_docker
needs: [build-release]
rules:
- if: $CI_COMMIT_TAG # Run this job when a tag is created
script:
- docker buildx imagetools create $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
- docker buildx imagetools create $CI_REGISTRY_IMAGE/languagetool:$CI_COMMIT_SHORT_SHA --tag $CI_REGISTRY_IMAGE/languagetool:$CI_COMMIT_TAG

- docker buildx build --provenance false --build-arg BUILDKIT_INLINE_CACHE=1 --build-arg VERSION="$VERSION_NUMBER" --cache-from $CI_REGISTRY_IMAGE/api-test:$CACHE_RELEASE_TAG --cache-from $CI_REGISTRY_IMAGE/api:$CACHE_RELEASE_TAG --target=api --platform linux/amd64,linux/arm64 --push --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG .

release-gitlab-release:
stage: release
needs: [release-docker-internal]
needs: [build-release]
image: registry.gitlab.com/gitlab-org/release-cli:latest
script:
- echo "works"
Expand Down
12 changes: 7 additions & 5 deletions languagetool/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
FROM erikvl87/languagetool:6.4
FROM elestio/languagetool:v6.4

# Add custom CA certificates
USER root
# PostgreSQL support
RUN wget https://github.com/pgjdbc/pgjdbc/releases/download/REL42.7.3/postgresql-42.7.3.jar -P libs --quiet \
RUN apk add --no-cache zip unzip wget \
&& wget https://github.com/pgjdbc/pgjdbc/releases/download/REL42.7.3/postgresql-42.7.3.jar -P libs --quiet \
&& wget https://github.com/pgjdbc/pgjdbc/archive/refs/tags/REL42.7.3.tar.gz -P /src --quiet \
&& mkdir -p org/languagetool/server \
&& unzip -p languagetool-server.jar org/languagetool/server/mybatis-config.xml | \
sed '/^\s*<\/dataSource>/i<property name="driver.prepareThreshold" value="0"\/>' \
> org/languagetool/server/mybatis-config.xml \
&& zip -u languagetool-server.jar org/languagetool/server/mybatis-config.xml
&& zip -u languagetool-server.jar org/languagetool/server/mybatis-config.xml \
&& apk del zip unzip wget ca-certificates

# Add custom wordlists
COPY scripts/* ./
COPY wordlists /custom-wordlists/
RUN /bin/bash add_wordlists.sh
RUN bash add_wordlists.sh

USER 100

0 comments on commit 42035b1

Please sign in to comment.