-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from BWibo/docker
Docker
- Loading branch information
Showing
5 changed files
with
276 additions
and
1 deletion.
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,21 @@ | ||
# Git and GitHub | ||
.github/ | ||
.git/ | ||
.gitignore | ||
.gitattributes | ||
|
||
# Gradle | ||
.gradle/ | ||
**/build/ | ||
|
||
# Docker | ||
.dockerignore | ||
Dockerfile* | ||
|
||
# Unused resources | ||
resources/3dcitydb | ||
resources/javadoc | ||
resources/license | ||
resources/samples | ||
LICENSE | ||
*.md |
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,89 @@ | ||
name: docker-build-push-edge | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
env: | ||
IMAGE_NAME: citydb-tool | ||
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7 | ||
|
||
jobs: | ||
build-push: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- | ||
name: Parse short sha | ||
uses: benjlevesque/[email protected] | ||
id: short-sha | ||
- | ||
name: set lower case owner name | ||
run: | | ||
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} | ||
env: | ||
OWNER: '${{ github.repository_owner }}' | ||
- | ||
name: Checkout repo | ||
uses: actions/checkout@v4 | ||
- | ||
name: Docker login Dockerhub | ||
id: docker_login | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: ${{ env.PLATFORMS }} | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Extract metadata (tags, labels) for docker image | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ env.OWNER_LC }}/${{ env.IMAGE_NAME }} | ||
ghcr.io/${{ env.OWNER_LC }}/${{ env.IMAGE_NAME }} | ||
flavor: | | ||
latest=false | ||
tags: | | ||
type=edge,branch=main | ||
labels: | | ||
maintainer=Bruno Willenborg | ||
maintainer.email=b.willenborg(at)tum.de | ||
maintainer.organization=Chair of Geoinformatics, Technical University of Munich (TUM) | ||
org.opencontainers.image.authors=Bruno Willenborg | ||
org.opencontainers.image.vendor=3DCityDB Steering Committee | ||
org.opencontainers.image.title=3D City Database 5.0 CLI tool Docker image | ||
org.opencontainers.image.description=3D City Database 5.0 CLI to import/export city model data and to run database operations | ||
org.opencontainers.image.url=https://github.com/3dcitydb/ | ||
org.opencontainers.image.documentation=https://github.com/3dcitydb/citydb-tool#docker | ||
org.opencontainers.image.source=https://github.com/3dcitydb/citydb-tool | ||
- | ||
name: Build and publish | ||
uses: docker/build-push-action@v5 | ||
id: docker_build | ||
with: | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: ${{ env.PLATFORMS }} | ||
build-args: | | ||
CITYDB_TOOL_VERSION=${{ steps.short-sha.outputs.sha }} | ||
- | ||
name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
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,88 @@ | ||
name: docker-build-push-release | ||
|
||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [published, edited] | ||
env: | ||
IMAGE_NAME: citydb-tool | ||
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7 | ||
|
||
jobs: | ||
build-push: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- | ||
name: Get release version without v | ||
id: release_version | ||
uses: battila7/get-version-action@v2 | ||
- | ||
name: set lower case owner name | ||
run: | | ||
echo "OWNER_LC=${OWNER,,}" >>${GITHUB_ENV} | ||
env: | ||
OWNER: '${{ github.repository_owner }}' | ||
- | ||
name: Checkout repo | ||
uses: actions/checkout@v4 | ||
- | ||
name: Docker login Dockerhub | ||
id: docker_login | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- | ||
name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
with: | ||
platforms: ${{ env.PLATFORMS }} | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- | ||
name: Extract metadata (tags, labels) for docker image | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: | | ||
${{ env.OWNER_LC }}/${{ env.IMAGE_NAME }} | ||
ghcr.io/${{ env.OWNER_LC }}/${{ env.IMAGE_NAME }} | ||
flavor: | | ||
latest=${{ !github.event.release.prerelease }} | ||
tags: | | ||
type=semver,pattern={{version}} | ||
labels: | | ||
maintainer=Bruno Willenborg | ||
maintainer.email=b.willenborg(at)tum.de | ||
maintainer.organization=Chair of Geoinformatics, Technical University of Munich (TUM) | ||
org.opencontainers.image.authors=Bruno Willenborg | ||
org.opencontainers.image.vendor=3DCityDB Steering Committee | ||
org.opencontainers.image.title=3D City Database 5.0 CLI tool Docker image | ||
org.opencontainers.image.description=3D City Database 5.0 CLI to import/export city model data and to run database operations | ||
org.opencontainers.image.url=https://github.com/3dcitydb/ | ||
org.opencontainers.image.documentation=https://github.com/3dcitydb/citydb-tool#docker | ||
org.opencontainers.image.source=https://github.com/3dcitydb/citydb-tool | ||
- | ||
name: Build and publish | ||
uses: docker/build-push-action@v5 | ||
id: docker_build | ||
with: | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: ${{ env.PLATFORMS }} | ||
build-args: | | ||
CITYDB_TOOL_VERSION=${{ steps.release_version.outputs.version }} | ||
- | ||
name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} |
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,41 @@ | ||
# 3DCityDB Importer/Exporter Dockerfile ####################################### | ||
# Official website https://www.3dcitydb.org | ||
# GitHub https://github.com/3dcitydb/citydb-tool | ||
############################################################################### | ||
|
||
# Fetch & build stage ######################################################### | ||
# ARGS | ||
ARG BUILDER_IMAGE_TAG='17-jdk-jammy' | ||
ARG RUNTIME_IMAGE_TAG='17-jdk-jammy' | ||
|
||
# Base image | ||
FROM eclipse-temurin:${BUILDER_IMAGE_TAG} AS builder | ||
|
||
# Copy source code | ||
WORKDIR /build | ||
COPY . /build | ||
|
||
# Build | ||
RUN chmod u+x ./gradlew && ./gradlew installDist | ||
|
||
# Runtime stage ############################################################### | ||
# Base image | ||
FROM eclipse-temurin:${RUNTIME_IMAGE_TAG} AS runtime | ||
|
||
# Version info | ||
ARG CITYDB_TOOL_VERSION | ||
ENV CITYDB_TOOL_VERSION=${CITYDB_TOOL_VERSION} | ||
|
||
# Copy from builder | ||
COPY --from=builder /build/citydb-cli/build/install/3DCityDB-Command-Line-Tool /opt/citydb-tool | ||
|
||
# Run as non-root user, put start script in path and set permissions | ||
RUN groupadd --gid 1000 -r citydb-tool && \ | ||
useradd --uid 1000 --gid 1000 -d /data -m -r --no-log-init citydb-tool && \ | ||
ln -sf /opt/citydb-tool/citydb /usr/local/bin | ||
|
||
WORKDIR /data | ||
USER 1000 | ||
|
||
ENTRYPOINT ["citydb"] | ||
CMD ["--help"] |
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