Skip to content

Commit

Permalink
Use here-document syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
gitfool committed Jun 27, 2022
1 parent 616cb20 commit 7d2b7c3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@

# Custom
*.sh text eol=lf
Dockerfile text eol=lf

# Linguist
*.cake linguist-language=C#
37 changes: 25 additions & 12 deletions Cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/runtime-deps:6.0.6-focal

LABEL org.opencontainers.image.source=https://github.com/gitfool/BoardGameGeek.Dungeon

# Install packages
RUN apt-get update \
&& apt-get install --no-install-recommends -y sudo vim \
&& rm -rf /var/lib/apt/lists/*
RUN <<EOF
set -ex
apt-get update
apt-get install --no-install-recommends -y sudo vim
rm -rf /var/lib/apt/lists/*
EOF

# Add non-root user
RUN groupadd --gid 1000 user \
&& useradd --uid 1000 --gid 1000 --shell /bin/bash -m user \
&& echo "user ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/user \
&& chmod 0440 /etc/sudoers.d/user
RUN <<EOF
set -ex
groupadd --gid 1000 user
useradd --uid 1000 --gid 1000 --shell /bin/bash -m user
echo "user ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/user
chmod 0440 /etc/sudoers.d/user
EOF

USER user

RUN echo "alias l='ls -aF'" >> ~/.bash_aliases \
&& echo "alias ll='ls -ahlF'" >> ~/.bash_aliases \
&& echo "alias ls='ls --color=auto --group-directories-first'" >> ~/.bash_aliases
RUN <<EOF
set -ex
echo "alias l='ls -aF'" >> ~/.bash_aliases
echo "alias ll='ls -ahlF'" >> ~/.bash_aliases
echo "alias ls='ls --color=auto --group-directories-first'" >> ~/.bash_aliases
EOF

# Install dungeon
ENV DOTNET_HostBuilder__ReloadConfigOnChange=false
Expand All @@ -26,7 +36,10 @@ WORKDIR /home/user/dungeon

COPY --chown=user:user bin/Release/linux-x64/publish .

RUN echo "alias d='cd ~/dungeon && ./bgg-dungeon'" >> ~/.bash_aliases \
&& chmod -x config/*.yaml
RUN <<EOF
set -ex
echo "alias d='cd ~/dungeon && ./bgg-dungeon'" >> ~/.bash_aliases
chmod -x config/*.yaml
EOF

ENTRYPOINT [ "./bgg-dungeon" ]

0 comments on commit 7d2b7c3

Please sign in to comment.