Skip to content

Commit 14b0168

Browse files
committed
Merge pull request #493 from Fryguy/build_in_docker
Add a Dockerfile for building the ui-components package
2 parents 4a06837 + aef145d commit 14b0168

File tree

5 files changed

+50
-0
lines changed

5 files changed

+50
-0
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/node_modules/
2+
/pkg/*.tgz

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ vendor.css
4444
coverage
4545
yarn.lock
4646
package-lock.json
47+
pkg/

Dockerfile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM python:2.7-buster
2+
3+
SHELL ["/bin/bash", "--login", "-c"]
4+
5+
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
6+
RUN nvm install 14
7+
RUN npm install --global yarn
8+
9+
WORKDIR /ui-components
10+
COPY . /ui-components
11+
RUN git clean -fdx
12+
RUN yarn install
13+
RUN yarn pack

bin/build

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
image="docker.io/manageiq/ui-components:latest"
6+
7+
# Build the image, which will build the package
8+
docker build . -t $image --no-cache
9+
10+
# Extract the package from the image
11+
container_id=$(docker create $image)
12+
package=$(docker run --rm -it --entrypoint /bin/bash $image -c "ls -1 manageiq-ui-components-*.tgz" | tr -d '\r')
13+
docker cp "$container_id:/ui-components/$package" pkg
14+
docker rm "$container_id"
15+
16+
echo
17+
echo "Package 'pkg/$package' has been built."
18+
echo
19+
20+
# Optionally publish the image
21+
read -r -p "Publish the package now? (y/N) " -n 1
22+
echo
23+
echo
24+
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
25+
pushd pkg >/dev/null
26+
npm login
27+
npm publish --access public $package
28+
popd >/dev/null
29+
else
30+
echo "You can manually publish the package with:"
31+
echo " cd pkg"
32+
echo " npm login"
33+
echo " npm publish --access public $package"
34+
fi

pkg/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)