Skip to content

Commit

Permalink
Merge pull request #11 from Cimbali/patch-1
Browse files Browse the repository at this point in the history
Add suse support in linux template
  • Loading branch information
freakboy3742 authored Aug 31, 2023
2 parents 8ff54e4 + 25ed21e commit fee561c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"vendor_base": "debian",
"dockerfile_extra_content": "",
"use_non_root_user": true,
"lib_dir": "lib{% if cookiecutter.vendor_base == 'rhel' %}64{% endif %}",
"lib_dir": "lib{% if cookiecutter.vendor_base in ('rhel', 'suse') %}64{% endif %}",
"_extensions": [
"briefcase.integrations.cookiecutter.PythonVersionExtension"
]
Expand Down
34 changes: 20 additions & 14 deletions {{ cookiecutter.format }}/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ RUN apt-get update -y && \
RUN dnf install -y \
python{{ cookiecutter.python_version|py_tag }}-devel \
python{{ cookiecutter.python_version|py_tag }}-pip
{%- elif cookiecutter.vendor_base == "suse" -%}
# Install System python
RUN zypper install -y \
python{{ cookiecutter.python_version|py_tag }}-devel \
python{{ cookiecutter.python_version|py_tag }}-pip
{%- elif cookiecutter.vendor_base == "arch" -%}
# Install System python
RUN pacman -Syu --noconfirm \
python{{ cookiecutter.python_version|py_tag }} \
python-pip
python{{ cookiecutter.python_version|py_tag }} \
python-pip
{%- endif %}

# Upgrade pip et alia
Expand All @@ -36,29 +41,30 @@ RUN pacman -Syu --noconfirm \
RUN PIP_BREAK_SYSTEM_PACKAGES=1 \
python3 -m pip install --no-cache-dir --upgrade pip setuptools wheel

{% if cookiecutter.use_non_root_user -%}
# Ensure Docker user UID:GID matches host user UID:GID (beeware/briefcase#403)
# Use --non-unique to avoid problems when the UID:GID of the host user
# collides with entries provided by the Docker container.
# Create Briefcase data dir so Docker's bind mount doesn't assign root as owner of .cache at runtime.
ARG HOST_UID
ARG HOST_GID
RUN groupadd --non-unique --gid $HOST_GID briefcase && \
useradd --non-unique --uid $HOST_UID --gid $HOST_GID brutus --home /home/brutus && \
mkdir -p /home/brutus && chown brutus:briefcase /home/brutus
{%- endif %}

# As root, install system packages required by app
ARG SYSTEM_REQUIRES
{% if cookiecutter.vendor_base == "debian" -%}
RUN apt-get install --no-install-recommends -y build-essential ${SYSTEM_REQUIRES}
{%- elif cookiecutter.vendor_base == "rhel" -%}
RUN dnf install -y rpm-build gcc make pkgconf-pkg-config ${SYSTEM_REQUIRES}
{%- elif cookiecutter.vendor_base == "suse" -%}
RUN zypper install -y -t pattern devel_basis
RUN zypper install -y pwdutils rpm-build pkgconf-pkg-config ${SYSTEM_REQUIRES}
{%- elif cookiecutter.vendor_base == "arch" -%}
RUN pacman -Syu --noconfirm base-devel ${SYSTEM_REQUIRES}
{%- endif %}

{% if cookiecutter.use_non_root_user -%}
# Ensure Docker user UID:GID matches host user UID:GID (beeware/briefcase#403)
# Use --non-unique to avoid problems when the UID:GID of the host user
# collides with entries provided by the Docker container.
# Create Briefcase data dir so Docker's bind mount doesn't assign root as owner of .cache at runtime.
ARG HOST_UID
ARG HOST_GID
RUN groupadd --non-unique --gid $HOST_GID briefcase && \
useradd --non-unique --uid $HOST_UID --gid $HOST_GID brutus --home /home/brutus && \
mkdir -p /home/brutus && chown brutus:briefcase /home/brutus

# Use the brutus user for operations in the container
USER brutus
{%- endif %}
Expand Down

0 comments on commit fee561c

Please sign in to comment.