Skip to content

Conversation

binboum
Copy link

@binboum binboum commented Nov 5, 2023

The goal is to make the code easy for others to understand without the need to search for dependencies.

Although the repository is older, it can still be valuable for resourceful individuals who come across it.

50
51

@binboum binboum changed the title Implement Docker image feat: Implement Docker image Nov 5, 2023
Comment on lines +16 to +26
RUN groupadd -g 1000 app \
&& useradd -d /app -s /bin/bash -g app app \
&& chown -R app:app /app

RUN git clone https://github.com/awilliam/rom-parser && \
cd rom-parser && \
make && \
chmod +x rom-parser && \
mv rom-parser /usr/local/bin

WORKDIR /app
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chown of /app before creation causes an error 0.102 chown: cannot access '/app': No such file or directory

Suggested change
RUN groupadd -g 1000 app \
&& useradd -d /app -s /bin/bash -g app app \
&& chown -R app:app /app
RUN git clone https://github.com/awilliam/rom-parser && \
cd rom-parser && \
make && \
chmod +x rom-parser && \
mv rom-parser /usr/local/bin
WORKDIR /app
WORKDIR /app
RUN groupadd -g 1000 app \
&& useradd -d /app -s /bin/bash -g app app \
&& chown -R app:app /app
RUN git clone https://github.com/awilliam/rom-parser && \
cd rom-parser && \
make && \
chmod +x rom-parser && \
mv rom-parser /usr/local/bin


ENV PATH=$PATH:$HOME/.gem/bin

RUN curl -LO https://github.com/LongSoft/UEFITool/releases/download/A68/UEFIExtract_NE_${UEFIExtract_VERSION}_x64_linux.zip && unzip UEFIExtract_NE_${UEFIExtract_VERSION}_x64_linux.zip && mv uefiextract ./3rdparty/UEFIExtract
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

URL doesn't update with argument properly

Suggested change
RUN curl -LO https://github.com/LongSoft/UEFITool/releases/download/A68/UEFIExtract_NE_${UEFIExtract_VERSION}_x64_linux.zip && unzip UEFIExtract_NE_${UEFIExtract_VERSION}_x64_linux.zip && mv uefiextract ./3rdparty/UEFIExtract
RUN curl -LO https://github.com/LongSoft/UEFITool/releases/download/${UEFIExtract_VERSION}/UEFIExtract_NE_${UEFIExtract_VERSION}_x64_linux.zip && unzip UEFIExtract_NE_${UEFIExtract_VERSION}_x64_linux.zip && mv uefiextract ./3rdparty/UEFIExtract

bundle config set --local path '/app/.gem' && \
bundle install --path=vendor/bundle

ENV PATH=$PATH:$HOME/.gem/bin
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Home doesn't work well, absolute path is better

Suggested change
ENV PATH=$PATH:$HOME/.gem/bin
ENV PATH="/app/.gem/bin:$PATH"

Comment on lines +28 to +44
USER app

COPY --chown=app:app . .

# https://github.com/coderobe/VBiosFinder/issues/50
# https://github.com/coderobe/VBiosFinder/pull/51
RUN git remote add vkhodygo https://github.com/vkhodygo/VBiosFinder.git && \
git fetch vkhodygo && \
git rebase

RUN mkdir -p /app/.gem && \
bundle config set --local path '/app/.gem' && \
bundle install --path=vendor/bundle

ENV PATH=$PATH:$HOME/.gem/bin

RUN curl -LO https://github.com/LongSoft/UEFITool/releases/download/A68/UEFIExtract_NE_${UEFIExtract_VERSION}_x64_linux.zip && unzip UEFIExtract_NE_${UEFIExtract_VERSION}_x64_linux.zip && mv uefiextract ./3rdparty/UEFIExtract
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is much better to layer modules and less frequently changing things first:

USER        app

RUN         mkdir ./output && mkdir ./3rdparty

RUN         curl -LO https://github.com/LongSoft/UEFITool/releases/download/${UEFIExtract_VERSION}/UEFIExtract_NE_${UEFIExtract_VERSION}_x64_linux.zip && unzip UEFIExtract_NE_${UEFIExtract_VERSION}_x64_linux.zip && mv uefiextract ./3rdparty/UEFIExtract

COPY        --chown=app:app Gemfile* ./

# Install the Ruby gems
RUN         mkdir -p /app/.gem && \
            bundle config set --local path '/app/.gem' && \
            bundle install --path=vendor/bundle

COPY        --chown=app:app . .

ENV         PATH="/app/.gem/bin:$PATH"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants