Skip to content

Commit

Permalink
Build separate for gh
Browse files Browse the repository at this point in the history
  • Loading branch information
jmandel committed May 30, 2024
1 parent ccbc3cc commit 4c24d3d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
13 changes: 3 additions & 10 deletions images/ig-publisher/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ LABEL maintainer="Josh Mandel"
LABEL org.opencontainers.image.source=https://github.com/fhir/auto-ig-builder
COPY ./localdev-files/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh

RUN apt-get update && apt-get -y install gosu && apt-get clean

RUN useradd -d /home/publisher -m publisher
USER publisher
RUN mkdir /home/publisher/ig && \
Expand All @@ -44,19 +46,10 @@ RUN mkdir /home/publisher/ig && \
WORKDIR /home/publisher/ig
VOLUME /home/publisher/ig
ENV PATH="/home/publisher/bin:/home/publisher/bin/ig-publisher-scripts:/home/publisher/.node/bin:${PATH}"
USER root
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["bash"]

# ------- Begin CI -------
FROM localdev as gh
LABEL maintainer="Josh Mandel"
LABEL org.opencontainers.image.source=https://github.com/fhir/auto-ig-builder
USER root
RUN groupmod -g 121 publisher && \
usermod -u 1001 publisher && \
chown -R publisher:publisher /home/publisher
USER publisher


# ------- Begin CI -------
FROM base as ci
Expand Down
22 changes: 19 additions & 3 deletions images/ig-publisher/localdev-files/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
#!/bin/bash
set -e

git clone https://github.com/HL7/ig-publisher-scripts /home/publisher/bin/ig-publisher-scripts
npm install -g fsh-sushi
# Change uid and gid of node user so it matches ownership of current dir
if [ "$MAP_NODE_UID" != "no" ]; then
if [ ! -d "$MAP_NODE_UID" ]; then
MAP_NODE_UID=$PWD
fi

exec "$@"
uid=$(stat -c '%u' "$MAP_NODE_UID")
gid=$(stat -c '%g' "$MAP_NODE_UID")
echo "publisher ---> UID = $uid / GID = $gid"

export USER=publisher

usermod -u $uid publisher 2> /dev/null && {
groupmod -g $gid publisher 2> /dev/null || usermod -a -G $gid publisher
}
fi

gosu publisher git clone https://github.com/HL7/ig-publisher-scripts /home/publisher/bin/ig-publisher-scripts
gosu publisher npm install -g fsh-sushi
exec gosu publisher "$@"

0 comments on commit 4c24d3d

Please sign in to comment.