Use docker to build gitea #78

Merged
6543 merged 7 commits from 6543/build-deploy-gitea:use-docker-to-build into master 10 months ago
6543 commented 12 months ago
Collaborator

use docker to build gitea, so you can deploy from any linux

use docker to build gitea, so you can deploy from any linux
6543 added 2 commits 12 months ago
6543 added 1 commit 12 months ago
Poster
Collaborator

I'm a bit worried about withdocker-deploy - if that's done well it's ready

I'm a bit worried about withdocker-deploy - if that's done well it's ready
6543 force-pushed use-docker-to-build from 6c4c07fa4b to 29658f2900 12 months ago
Owner

I'll try it out later today & will let you know if I experience any problems.

I'll try it out later today & will let you know if I experience any problems.
6543 added 1 commit 11 months ago
6543 changed title from WIP: Use docker to build gitea to Use docker to build gitea 11 months ago
Poster
Collaborator

@momar ping

@momar ping
6543 added 1 commit 11 months ago
momar reviewed 11 months ago
Makefile Outdated
withdocker:
mkdir -p ${BUILDDIR}
docker run -it -v ${shell pwd}:/build $(shell docker build -q .) bash -c "(cd build; make)"
Owner

IMO we should use --rm with the docker run commands, otherwise a lot of stopped containers will be left after a debugging session.

IMO we should use `--rm` with the `docker run` commands, otherwise a lot of stopped containers will be left after a debugging session.
Owner

I also find it a bit unintuitive that the docker build is silent, as it can take a long time. Can we use docker build -t codeberg.org/codeberg/build-deploy-gitea . before to seperate the two steps?

I also find it a bit unintuitive that the `docker build` is silent, as it can take a long time. Can we use `docker build -t codeberg.org/codeberg/build-deploy-gitea .` before to seperate the two steps?
Owner

Also, -w /build can be used to avoid invoking bash before make.

Also, `-w /build` can be used to avoid invoking bash before make.
Owner

Oh, and I think ${shell pwd}:/build needs to be in quotes, as otherwise directories with spaces probably will break stuff.

Oh, and I think `${shell pwd}:/build` needs to be in quotes, as otherwise directories with spaces probably will break stuff.
6543 marked this conversation as resolved
momar reviewed 11 months ago
withdocker-deploy:
mkdir -p ${BUILDDIR}
docker run -it -v ${shell pwd}:/build -v ~/.ssh:/root/.host_ssh:ro $(shell docker build -q .) bash -c "(cd build; mkdir -p /root/.ssh; cat /root/.host_ssh/id_rsa > /root/.ssh/id_rsa; chmod 600 /root/.ssh/id_rsa; make deployment)"
Owner

I'm not using an RSA key but rather an ED25519 one, so maybe we can use -v ~/.ssh:/root/.ssh:ro -u $(shell id -u) instead, with the advantage that everything's being run with the host user's permissions & no root files are created in a user directory?

I'm not using an RSA key but rather an ED25519 one, so maybe we can use `-v ~/.ssh:/root/.ssh:ro -u $(shell id -u)` instead, with the advantage that everything's being run with the host user's permissions & no root files are created in a user directory?
Owner

Also, ~/.ssh isn't understood by Docker on my system, I have to use $HOME/.ssh.

Also, `~/.ssh` isn't understood by Docker on my system, I have to use `$HOME/.ssh`.
Owner

Oh, and it seems like the user account must exist for SSH to be working. A simple entrypoint script should fix this, but this is quickly getting quite complex...

Oh, and it seems like the user account must exist for SSH to be working. A simple entrypoint script should fix this, but this is quickly getting quite complex...
6543 marked this conversation as resolved
Owner

Alright, got it working with my suggested changes - could you take a quick glance to see if I missed anything?

Alright, got it working with my suggested changes - could you take a quick glance to see if I missed anything?
momar force-pushed use-docker-to-build from d8bcc485e0 to 7b5d64e8c1 11 months ago
6543 added 1 commit 10 months ago
Poster
Collaborator

works :)

works :)
6543 merged commit 963f211b78 into master 10 months ago
6543 referenced this issue from a commit 10 months ago
6543 deleted branch use-docker-to-build 10 months ago
6543 referenced this issue from a commit 10 months ago
The pull request has been merged as 963f211b78.
Sign in to join this conversation.
Loading…
There is no content yet.