Skip to content

Commit

Permalink
fix ubi
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanmelt committed Jan 25, 2025
1 parent e7dc5e4 commit 889a769
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 10 deletions.
28 changes: 28 additions & 0 deletions openc3-cosmos-cmd-tlm-api/Dockerfile-ubi
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
ARG OPENC3_REGISTRY=docker.io
ARG OPENC3_NAMESPACE=openc3inc
ARG OPENC3_TAG=latest
ARG OPENC3_IMAGE=openc3-base

FROM ${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/${OPENC3_IMAGE}:${OPENC3_TAG}

WORKDIR /src/
COPY Gemfile ./

USER root

RUN bundle config set --local without 'development' \
&& bundle install --quiet \
&& rm Gemfile.lock \
&& rm -rf /usr/lib/ruby/gems/*/cache/* \
/var/cache/apk/* \
/tmp/* \
/var/tmp/*

RUN ["chown", "-R", "openc3:openc3", "/src/"]
COPY --chown=${IMAGE_USER}:${IMAGE_GROUP} ./ ./
RUN ["chmod", "-R", "777", "/src/"]

EXPOSE 2901

USER ${USER_ID}:${GROUP_ID}
CMD [ "shoreman" ]
29 changes: 29 additions & 0 deletions openc3-cosmos-script-runner-api/Dockerfile-ubi
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
ARG OPENC3_REGISTRY=docker.io
ARG OPENC3_NAMESPACE=openc3inc
ARG OPENC3_TAG=latest
ARG OPENC3_IMAGE=openc3-base

FROM ${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/${OPENC3_IMAGE}:${OPENC3_TAG}

WORKDIR /src/
COPY Gemfile ./

USER root

RUN bundle config set --local without 'development' \
&& bundle install --quiet \
&& rm Gemfile.lock \
&& rm -rf /usr/lib/ruby/gems/*/cache/* \
/var/cache/apk/* \
/tmp/* \
/var/tmp/*

RUN ["chown", "-R", "openc3:openc3", "/src/"]
COPY --chown=${IMAGE_USER}:${IMAGE_GROUP} ./ ./
RUN ["chmod", "-R", "777", "/src/"]
RUN ["chmod", "-R", "555", "/src/scripts"]

EXPOSE 2902

USER ${USER_ID}:${GROUP_ID}
CMD [ "shoreman" ]
4 changes: 2 additions & 2 deletions openc3-ruby/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Make managed in .env-build
ARG OPENC3_DEPENDENCY_REGISTRY=docker.io
ARG ALPINE_BUILD
ARG ALPINE_VERSION
ARG ALPINE_BUILD=6
ARG ALPINE_VERSION=3.19

# Should be loaded from ARG
FROM ${OPENC3_DEPENDENCY_REGISTRY}/alpine:${ALPINE_VERSION}.${ALPINE_BUILD}
Expand Down
13 changes: 5 additions & 8 deletions openc3-ruby/Dockerfile-ubi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG OPENC3_UBI_REGISTRY
ARG OPENC3_UBI_IMAGE
ARG OPENC3_UBI_TAG
ARG OPENC3_UBI_REGISTRY=registry1.dso.mil
ARG OPENC3_UBI_IMAGE=ironbank/redhat/ubi/ubi8-minimal
ARG OPENC3_UBI_TAG=8.8

FROM ${OPENC3_UBI_REGISTRY}/${OPENC3_UBI_IMAGE}:${OPENC3_UBI_TAG}

Expand Down Expand Up @@ -69,11 +69,8 @@ RUN cd / \
RUN cd / \
&& gem update --system 3.3.14 \
&& gem install rake \
# These need to be installed with the --platform flag to avoid errors on linux-musl
# See: https://github.com/protocolbuffers/protobuf/issues/16853#issuecomment-2583135716
# Should be fixed April 2025
&& gem install google-protobuf --platform ruby \
&& gem install grpc --platform ruby \
&& gem install google-protobuf \
&& gem install grpc \
&& gem cleanup \
&& bundle config build.nokogiri --use-system-libraries \
&& bundle config git.allow_insecure true \
Expand Down
42 changes: 42 additions & 0 deletions openc3/Dockerfile-ubi
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
ARG OPENC3_REGISTRY=docker.io
ARG OPENC3_NAMESPACE=openc3inc
ARG OPENC3_TAG=latest
ARG OPENC3_IMAGE=openc3-ruby

FROM ${OPENC3_REGISTRY}/${OPENC3_NAMESPACE}/${OPENC3_IMAGE}:${OPENC3_TAG}

WORKDIR /openc3/

USER ${USER_ID}:${GROUP_ID}

COPY --chown=${IMAGE_USER}:${IMAGE_GROUP} . .

USER root

RUN mkdir -p lib/openc3/ext \
&& git config --global http.sslCAinfo /devel/cacert.pem \
&& bundle config set --local without 'development' \
&& bundle install --quiet \
&& rake gems \
&& gem install --local ./openc3-*.gem \
&& openc3_gem=$(dirname `gem which openc3`) \
&& ln -s $openc3_gem/openc3 $openc3_gem/cosmos \
&& mkdir -p gems \
&& mv *.gem gems/. \
&& gem cleanup \
&& rm -rf /usr/lib/ruby/gems/*/cache/* /var/cache/apk/* /tmp/* /var/tmp/*

WORKDIR /openc3/python

RUN . /openc3/venv/bin/activate \
&& pip3 install -r requirements.txt && pip3 install --pre .

WORKDIR /openc3/

RUN mkdir /gems && chown openc3:openc3 /gems
RUN mkdir /plugins && chown openc3:openc3 /plugins
RUN ["chmod", "-R", "777", "/gems/"]
RUN ["chmod", "-R", "777", "/plugins/"]
RUN ["chmod", "-R", "777", "/openc3/"]
ENV HOME=/openc3
USER ${USER_ID}:${GROUP_ID}
3 changes: 3 additions & 0 deletions scripts/linux/openc3_build_ubi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ cd ..
# openc3-base
cd openc3
docker build \
-f Dockerfile-ubi \
--network host \
--build-arg OPENC3_REGISTRY=$OPENC3_REGISTRY \
--build-arg OPENC3_NAMESPACE=$OPENC3_NAMESPACE \
Expand Down Expand Up @@ -88,6 +89,7 @@ cd ..
# openc3-cosmos-cmd-tlm-api
cd openc3-cosmos-cmd-tlm-api
docker build \
-f Dockerfile-ubi \
--network host \
--build-arg OPENC3_REGISTRY=$OPENC3_REGISTRY \
--build-arg OPENC3_NAMESPACE=$OPENC3_NAMESPACE \
Expand All @@ -101,6 +103,7 @@ cd ..
# openc3-cosmos-script-runner-api
cd openc3-cosmos-script-runner-api
docker build \
-f Dockerfile-ubi \
--network host \
--build-arg OPENC3_REGISTRY=$OPENC3_REGISTRY \
--build-arg OPENC3_NAMESPACE=$OPENC3_NAMESPACE \
Expand Down

0 comments on commit 889a769

Please sign in to comment.