Skip to content

Commit

Permalink
Prepare Dockerfile to build in OSBS
Browse files Browse the repository at this point in the history
Signed-off-by: Vladyslav Zhukovskyi <[email protected]>
  • Loading branch information
vzhukovs committed Jul 27, 2021
1 parent 0078816 commit b3de2e4
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
**

!/build/ide-packaging
!/build/projector-server-assembly
!/static/**
!/ide-packaging
!/projector-server-assembly
!/static-assembly
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.DS_Store
.idea
*.iml
*.tar.gz
build
ide-packaging
projector-server-assembly
static-assembly
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This document reflects the project's changes made after each release cycle

### Changed

- TBD
- Prepare Dockerfile to build in OSBS ([#43](https://github.com/che-incubator/jetbrains-editor-images/pull/43))

### Fixed

Expand Down
23 changes: 15 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,32 @@
# $ ./projector.sh build [OPTIONS]

# Stage 1. Prepare JetBrains IDE with Projector.
# Requires build/ide-packaging which should point to the ide packaging downloaded
# previously, usually tar.gz archive. Also requires build/projector-server-assembly
# which points to the built Projector Server assembly.
# Requires ide-packaging which should point to the ide packaging downloaded
# previously, usually tar.gz archive. Also requires projector-server-assembly
# which points to the built Projector Server assembly, zip archive. Requires
# static-assembly a gzipped static directory.
FROM registry.access.redhat.com/ubi8-minimal:8.4-205 as projectorAssembly
ENV PROJECTOR_DIR /projector
ADD build/ide-packaging /tmp/ide-unpacked
ADD build/projector-server-assembly $PROJECTOR_DIR/projector-server.zip
ADD static $PROJECTOR_DIR
COPY ide-packaging /tmp/ide-unpacked/
COPY projector-server-assembly $PROJECTOR_DIR/
COPY static-assembly $PROJECTOR_DIR/
RUN set -ex \
&& microdnf install -y --nodocs findutils tar gzip unzip \
&& cd /tmp/ide-unpacked \
&& tar xf ide-packaging \
&& rm ide-packaging \
&& find . -maxdepth 1 -type d -name * -exec mv {} $PROJECTOR_DIR/ide \; \
&& cd $PROJECTOR_DIR \
&& rm -rf /tmp/ide-unpacked \
&& unzip projector-server.zip \
&& rm projector-server.zip \
&& unzip projector-server-assembly \
&& rm projector-server-assembly \
&& find . -maxdepth 1 -type d -name projector-server-* -exec mv {} projector-server \; \
&& mv projector-server ide/projector-server \
&& chmod 644 ide/projector-server/lib/* \
&& tar -xf static-assembly \
&& rm static-assembly \
&& mv static/* . \
&& rm -rf static \
&& mv ide-projector-launcher.sh ide/bin \
&& find . -exec chgrp 0 {} \; -exec chmod g+rwX {} \; \
&& find . -name "*.sh" -exec chmod +x {} \; \
Expand Down
19 changes: 17 additions & 2 deletions projector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ RUN_ON_BUILD=false
SAVE_ON_BUILD=false
SAVE_ON_BUILD_DIRECTORY="$BUILD_DIRECTORY"/docker
IDE_PACKAGING_DIRECTORY="$BUILD_DIRECTORY"/ide
CURRENT_IDE_PACKAGING_SYMLINK="$BUILD_DIRECTORY"/ide-packaging
CURRENT_PROJECTOR_ASSEMBLY_SYMLINK="$BUILD_DIRECTORY"/projector-server-assembly
CURRENT_IDE_PACKAGING_SYMLINK="$base_dir"/ide-packaging
CURRENT_PROJECTOR_ASSEMBLY_SYMLINK="$base_dir"/projector-server-assembly
CURRENT_PROJECTOR_STATIC_ASSEMBLY="$base_dir"/static-assembly
PROGRESS=auto
CONFIG_JSON=compatible-ide.json
CONFIG_JSON_PATH="$base_dir"/"$CONFIG_JSON"
Expand Down Expand Up @@ -347,6 +348,18 @@ runOnBuild() {
fi
}

prepareStaticFiles() {
cd "$base_dir" || exit 1
.log 7 "Current working directory '$(pwd)'"
if [ -f "$CURRENT_PROJECTOR_STATIC_ASSEMBLY" ]; then
.log 7 "Removing symlink '$CURRENT_PROJECTOR_STATIC_ASSEMBLY'"
rm "$CURRENT_PROJECTOR_STATIC_ASSEMBLY"
fi

.log 7 "Creating archive for Projector static files '$CURRENT_PROJECTOR_STATIC_ASSEMBLY'"
tar -czf "$CURRENT_PROJECTOR_STATIC_ASSEMBLY" static
}

prepareAssembly() {
if [ -z "$URL" ]; then
.log 7 "Ignoring --tag and --url option"
Expand All @@ -355,6 +368,7 @@ prepareAssembly() {
# Run interactive wizard to choose IDE packaging from predefined configuration
selectPackagingFromPredefinedConfig
fi
prepareStaticFiles
downloadIdePackaging
checkProjectorSourcesExist
projectorBuild
Expand Down Expand Up @@ -393,6 +407,7 @@ buildContainerImage() {
selectPackagingFromPredefinedConfig
fi

prepareStaticFiles
downloadIdePackaging
checkProjectorSourcesExist
projectorBuild
Expand Down

0 comments on commit b3de2e4

Please sign in to comment.