Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Update image to run as a non root user #47

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

insuusvenerati
Copy link

This PR updates the image to run as a non root user. To reduce the amount of changes, I simply changed the base image to use cm2network/steamcmd:latest.

The reason for this is that https://github.com/CM2Walki/steamcmd is already configured to run as a non root user with steamcmd existing in /home/steam/steamcmd.sh and the valve wiki for SteamCMD points to it. https://developer.valvesoftware.com/wiki/SteamCMD#Docker

@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 6, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@Renegade-Master
Copy link
Owner

Renegade-Master commented Nov 6, 2022

Thanks for the contribution!

This base image looks massive though, and contains unnecessary things.
https://github.com/CM2Walki/steamcmd/blob/master/bullseye/Dockerfile

I've triggered the GH Actions though, and we'll see if that works. I would rather fix my own base image than use this at the moment however. 41 MiB -> 182 MiB is quite the leap, and I doubt any of those bytes actually help with the permissions.

@Renegade-Master
Copy link
Owner

This is promising though, because to be fair the CM2 image handles users a lot more like how I originally did, so I was probably not far off with the original implementation.

zomboid
steamcmd

@Renegade-Master Renegade-Master linked an issue Nov 6, 2022 that may be closed by this pull request
@Renegade-Master Renegade-Master added the enhancement / feature request New feature or request label Nov 6, 2022
@Renegade-Master
Copy link
Owner

@insuusvenerati
Some progress 🙂

Does this look correct to you? I will make similar changes to this repo, but that PR should sort out the base image.

@insuusvenerati
Copy link
Author

@insuusvenerati Some progress slightly_smiling_face

Does this look correct to you? I will make similar changes to this repo, but that PR should sort out the base image.

I'll spin up a server with that PR tonight and check it out! At first glance, it does look good.

@Renegade-Master
Copy link
Owner

Renegade-Master commented Nov 10, 2022

I'll spin up a server with that PR tonight and check it out! At first glance, it does look good.

It's not quite ready yet. Running into some issues.
I will probably have to start releasing "root" and "non-root" versions of the base image so that I can still install Python in this one.

Definite progress though. I now understand what I was doing wrong when I initially tried this.

@jsknnr
Copy link

jsknnr commented Jul 26, 2023

Your tests are what is broken now.

Try this:

      - name: Make Docker Directories
        if: matrix.system == 'docker' || matrix.system == 'docker-compose'
        run: |
          mkdir ZomboidConfig ZomboidDedicatedServer
          sudo chown -R 1000:1000 ZomboidConfig ZomboidDedicatedServer

      - name: Make Podman Directories
        if: matrix.system == 'podman' 
        run: |
          mkdir ZomboidConfig ZomboidDedicatedServer
          podman unshare chown 1000:1000 $(pwd)/ZomboidDedicatedServer
          podman unshare chown 1000:1000 $(pwd)/ZomboidConfig

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement / feature request New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't recreate the entire server on restart
3 participants