Skip to content

Commit

Permalink
Add compatibility with Openshift
Browse files Browse the repository at this point in the history
- Change USER options form Dockerfile to use uid
  • Loading branch information
wiltonsr committed Jun 18, 2024
1 parent 6132fc4 commit a336211
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
5 changes: 3 additions & 2 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ FROM gcc:11 as compile-stage
RUN apt update ; \
apt install cvs -y

RUN useradd opentracker
RUN useradd farmhand && \
usermod -u 6969 farmhand

WORKDIR /usr/src

Expand Down Expand Up @@ -31,7 +32,7 @@ COPY --from=compile-stage /etc/passwd /etc/passwd

WORKDIR /etc/opentracker

USER opentracker
USER 6969

EXPOSE 6969/udp
EXPOSE 6969/tcp
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ All `tags` use default configuration file from [here](https://erdgeist.org/gitwe

Some adjusts are made:

- `tracker.user` is setted to `opentracker` [USER](https://docs.docker.com/engine/reference/builder/#user) in all tags.
- `tracker.user` is setted to `farmhand` [USER](https://docs.docker.com/engine/reference/builder/#user) in all tags.
- `access.whitelist` is setted to `/etc/opentracker/whitelist` in `whitelist` tag.
- `access.blacklist` is setted to `/etc/opentracker/blacklist` in `blacklist` tag.

Expand Down
7 changes: 4 additions & 3 deletions blacklist.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ FROM gcc:11 as compile-stage
RUN apt update ; \
apt install cvs -y

RUN useradd opentracker
RUN useradd farmhand && \
usermod -u 6969 farmhand

WORKDIR /usr/src

Expand All @@ -30,7 +31,7 @@ RUN cd /usr/src/opentracker ; \
cp -v opentracker.conf.sample /tmp/stage/etc/opentracker/opentracker.conf ; \
# Opentrack conf blacklist sed expressions
sed -ri -e '\
s!(.*)(tracker.user)(.*)!\2 opentracker!g; \
s!(.*)(tracker.user)(.*)!\2 farmhand!g; \
s!(.*)(access.blacklist)(.*)!\2 /etc/opentracker/blacklist!g; \
' /tmp/stage/etc/opentracker/opentracker.conf ; \
touch /tmp/stage/etc/opentracker/blacklist ; \
Expand All @@ -44,7 +45,7 @@ COPY --from=compile-stage /etc/passwd /etc/passwd

WORKDIR /etc/opentracker

USER opentracker
USER 6969

EXPOSE 6969/udp
EXPOSE 6969/tcp
Expand Down
7 changes: 4 additions & 3 deletions open.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ FROM gcc:11 as compile-stage
RUN apt update ; \
apt install cvs -y

RUN useradd opentracker
RUN useradd farmhand && \
usermod -u 6969 farmhand

WORKDIR /usr/src

Expand All @@ -27,7 +28,7 @@ RUN cd /usr/src/opentracker ; \
cp -v opentracker.conf.sample /tmp/stage/etc/opentracker/opentracker.conf ; \
# Opentrack conf whitelist sed expressions
sed -ri -e '\
s!(.*)(tracker.user)(.*)!\2 opentracker!g; \
s!(.*)(tracker.user)(.*)!\2 farmhand!g; \
' /tmp/stage/etc/opentracker/opentracker.conf ; \
install -m 755 opentracker.debug /tmp/stage/bin ; \
make DESTDIR=/tmp/stage BINDIR="/bin" install
Expand All @@ -39,7 +40,7 @@ COPY --from=compile-stage /etc/passwd /etc/passwd

WORKDIR /etc/opentracker

USER opentracker
USER 6969

EXPOSE 6969/udp
EXPOSE 6969/tcp
Expand Down
6 changes: 3 additions & 3 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ __EOF__
cat <<'__EOF__' >/tmp/opentrackerSedExpressions
# Opentrack conf whitelist sed expressions
sed -ri -e '\
s!(.*)(tracker.user)(.*)!\2 opentracker!g; \
s!(.*)(tracker.user)(.*)!\2 farmhand!g; \
' /tmp/stage/etc/opentracker/opentracker.conf ; \
__EOF__

Expand All @@ -53,7 +53,7 @@ __EOF__
cat <<'__EOF__' >/tmp/opentrackerSedExpressions
# Opentrack conf blacklist sed expressions
sed -ri -e '\
s!(.*)(tracker.user)(.*)!\2 opentracker!g; \
s!(.*)(tracker.user)(.*)!\2 farmhand!g; \
s!(.*)(access.blacklist)(.*)!\2 /etc/opentracker/blacklist!g; \
' /tmp/stage/etc/opentracker/opentracker.conf ; \
touch /tmp/stage/etc/opentracker/blacklist ; \
Expand All @@ -72,7 +72,7 @@ __EOF__
cat <<'__EOF__' >/tmp/opentrackerSedExpressions
# Opentrack conf whitelist sed expressions
sed -ri -e '\
s!(.*)(tracker.user)(.*)!\2 opentracker!g; \
s!(.*)(tracker.user)(.*)!\2 farmhand!g; \
s!(.*)(access.whitelist)(.*)!\2 /etc/opentracker/whitelist!g; \
' /tmp/stage/etc/opentracker/opentracker.conf ; \
touch /tmp/stage/etc/opentracker/whitelist ; \
Expand Down
7 changes: 4 additions & 3 deletions whitelist.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ FROM gcc:11 as compile-stage
RUN apt update ; \
apt install cvs -y

RUN useradd opentracker
RUN useradd farmhand && \
usermod -u 6969 farmhand

WORKDIR /usr/src

Expand All @@ -30,7 +31,7 @@ RUN cd /usr/src/opentracker ; \
cp -v opentracker.conf.sample /tmp/stage/etc/opentracker/opentracker.conf ; \
# Opentrack conf whitelist sed expressions
sed -ri -e '\
s!(.*)(tracker.user)(.*)!\2 opentracker!g; \
s!(.*)(tracker.user)(.*)!\2 farmhand!g; \
s!(.*)(access.whitelist)(.*)!\2 /etc/opentracker/whitelist!g; \
' /tmp/stage/etc/opentracker/opentracker.conf ; \
touch /tmp/stage/etc/opentracker/whitelist ; \
Expand All @@ -44,7 +45,7 @@ COPY --from=compile-stage /etc/passwd /etc/passwd

WORKDIR /etc/opentracker

USER opentracker
USER 6969

EXPOSE 6969/udp
EXPOSE 6969/tcp
Expand Down

0 comments on commit a336211

Please sign in to comment.