Skip to content

Commit

Permalink
Merge pull request #493 from Fryguy/build_in_docker
Browse files Browse the repository at this point in the history
Add a Dockerfile for building the ui-components package
  • Loading branch information
agrare committed Mar 19, 2024
2 parents 4a06837 + aef145d commit 14b0168
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules/
/pkg/*.tgz
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ vendor.css
coverage
yarn.lock
package-lock.json
pkg/
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM python:2.7-buster

SHELL ["/bin/bash", "--login", "-c"]

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
RUN nvm install 14
RUN npm install --global yarn

WORKDIR /ui-components
COPY . /ui-components
RUN git clean -fdx
RUN yarn install
RUN yarn pack
34 changes: 34 additions & 0 deletions bin/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -e

image="docker.io/manageiq/ui-components:latest"

# Build the image, which will build the package
docker build . -t $image --no-cache

# Extract the package from the image
container_id=$(docker create $image)
package=$(docker run --rm -it --entrypoint /bin/bash $image -c "ls -1 manageiq-ui-components-*.tgz" | tr -d '\r')
docker cp "$container_id:/ui-components/$package" pkg
docker rm "$container_id"

echo
echo "Package 'pkg/$package' has been built."
echo

# Optionally publish the image
read -r -p "Publish the package now? (y/N) " -n 1
echo
echo
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
pushd pkg >/dev/null
npm login
npm publish --access public $package
popd >/dev/null
else
echo "You can manually publish the package with:"
echo " cd pkg"
echo " npm login"
echo " npm publish --access public $package"
fi
Empty file added pkg/.gitkeep
Empty file.

0 comments on commit 14b0168

Please sign in to comment.