# Inject patch in Docker Installation

**URL:** https://meta.discourse.org/t/inject-patch-in-docker-installation/48994
**Category:** Self-hosting
**Created:** [August 22, 2016, 11:39am UTC](https://meta.discourse.org/t/inject-patch-in-docker-installation/48994 "2016-08-22T11:39:13Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![dorianamouroux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dorianamouroux/32/120754_2.png) [@dorianamouroux](https://meta.discourse.org/u/dorianamouroux)
#### Post date: [August 22, 2016, 11:39am UTC](https://meta.discourse.org/t/inject-patch-in-docker-installation/48994/1 "2016-08-22T11:39:13Z")

</div>

Hello there,

I’m trying to setup a single sign on system from my custom oauth2 provider.  
I found this topic to overwrite the process after successful redirection : [https://meta.discourse.org/t/disable-create-account-screen-for-cas-logins/11334/6](https://meta.discourse.org/t/disable-create-account-screen-for-cas-logins/11334/6)  
I’m using the docker installation, I don’t know how to inject code inside the container, should I bundle this around a plugin and clone it in the after\_code hooks ?

Thank you for your help,

Dorian

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [August 22, 2016, 11:12pm UTC](https://meta.discourse.org/t/inject-patch-in-docker-installation/48994/2 "2016-08-22T23:12:36Z")

</div>

Yes, you should bundle the necessary functionality into a plugin and install it as part of the container build. You could also change the location that Discourse itself is cloned from to a git repo that contains the patches you want, but forking the main Discourse codebase is just going to leave you with a maintenance headache in the future when you need to update to a newer version of Discourse. So stick with a plugin.

---

<div class="post-metadata">

### Author: ![dorianamouroux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dorianamouroux/32/120754_2.png) [@dorianamouroux](https://meta.discourse.org/u/dorianamouroux)
#### Post date: [August 23, 2016, 1:10pm UTC](https://meta.discourse.org/t/inject-patch-in-docker-installation/48994/3 "2016-08-23T13:10:54Z")

</div>

I created a private repository and managed to clone it with mounting my ssh key folder, thank you for your help !

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [August 23, 2016, 11:33pm UTC](https://meta.discourse.org/t/inject-patch-in-docker-installation/48994/4 "2016-08-23T23:33:53Z")

</div>

World of pain commencing in 3… 2… 1…

---

<div class="post-metadata">

### Author: ![dorianamouroux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dorianamouroux/32/120754_2.png) [@dorianamouroux](https://meta.discourse.org/u/dorianamouroux)
#### Post date: [August 24, 2016, 4:52pm UTC](https://meta.discourse.org/t/inject-patch-in-docker-installation/48994/5 "2016-08-24T16:52:12Z")

</div>

It was pretty easy

```plaintext
  - volume:
      host: /home/server/.ssh
      guest: /root/.ssh

```

and

```plaintext
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone git@github.com:dorianamouroux/private_repo.git

```

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [August 24, 2016, 4:54pm UTC](https://meta.discourse.org/t/inject-patch-in-docker-installation/48994/6 "2016-08-24T16:54:01Z")

</div>

Ahhhhhhhhhhhhhhhhhh

> [@dorianamouroux](#):
>
> I created a private repository and managed to clone it

I guess @mpalmer undestood the same as me. That the private repo was a Discourse fork! It’s a plugin! That’s perfect!

---

<div class="post-metadata">

### Author: ![dorianamouroux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dorianamouroux/32/120754_2.png) [@dorianamouroux](https://meta.discourse.org/u/dorianamouroux)
#### Post date: [August 24, 2016, 10:10pm UTC](https://meta.discourse.org/t/inject-patch-in-docker-installation/48994/7 "2016-08-24T22:10:20Z")

</div>

Haha no, just private repository.  
But having a private fork of a project is not that complicated, you juste need 2 git remote and you pull the public one when you want updates, I did it for gollum wiki it works like a charm (the project is barely maintained now though)

---

<div class="post-metadata">

### Author: ![mntbighker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mntbighker/32/61718_2.png) [@mntbighker](https://meta.discourse.org/u/mntbighker)
#### Post date: [August 24, 2016, 10:22pm UTC](https://meta.discourse.org/t/inject-patch-in-docker-installation/48994/8 "2016-08-24T22:22:57Z")

</div>

I had a similar problem, but getting the GitLab oauth to work. I did the following:

```
volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://gitlab.com/gitlab-org/discourse-omniauth-gitlab.git
run:
  - exec: echo "Beginning of custom commands"
  ## If you want to set the 'From' email address for your first registration, uncomment and change:
  ## After getting the first signup email, re-comment the line. It only needs to run once.
  #- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"

  - exec: apt install unzip
  - exec: unzip /shared/ssl/NTAM_Collection_Ubuntu_2016.2.zip -d /usr/local/share/ca-certificates/
  - exec: chmod 444 /usr/local/share/ca-certificates/*
  - exec: c_rehash /usr/local/share/ca-certificates
  - exec: update-ca-certificates

  - exec: echo "End of custom commands"

```

---

<div class="post-metadata">

### Author: ![mpalmer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mpalmer/32/45740_2.png) [@mpalmer](https://meta.discourse.org/u/mpalmer)
#### Post date: [August 24, 2016, 10:25pm UTC](https://meta.discourse.org/t/inject-patch-in-docker-installation/48994/9 "2016-08-24T22:25:40Z")

</div>

Sorry I misunderstood what you were saying.

As far as maintaining a private fork of Discourse, here’s the difference:

> [@dorianamouroux](#):
>
> I did it for gollum wiki it works like a charm ( **the project is barely maintained now though** )

Discourse has several people employed full-time to add features and fix bugs (including security bugs), as well as a large number of fantastic contributors from all over the Internet. There’s a pretty good chance the changes in a private fork is going to end up conflicting with the changes made in mainline fairly often, necessitating manual review and modification of the local patches.
