Commit graph

44 commits

Author SHA1 Message Date
Renovate Bot
df907ec7f9 Update golang packages 2024-08-21 09:58:16 +00:00
limiting-factor
b6efebc237
feat: add forgejo-cli to the container images
When the Forgejo CLI binary is `forgejo-cli`, the `--verbose` or `--quiet`
arguments are available globally for all sub-commands. The same
sub-commands can be used with `forgejo forgejo-cli`, those flags are
not available.
2024-08-19 09:44:04 +02:00
silverwind
374964cd07
Fix deprecated Dockerfile ENV format (#31450)
See
https://docs.docker.com/reference/build-checks/legacy-key-value-format/.
Fixes these warnings seen during the docker build:

```
 4 warnings found (use --debug to expand):
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 5)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 9)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 75)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 76)
 ```

Introduced in: https://github.com/moby/buildkit/pull/4923

(cherry picked from commit 996037fb6a61b1a7f9a0a837fd87bbeab9cad154)

Conflicts:
	Dockerfile.rootless
	trivial context conflict
2024-06-23 13:20:40 +02:00
Earl Warren
d71afb71da
feat(release): upgrade to golang:1.22-alpine3.20
This reverts commit d59ed64345.
2024-06-04 23:50:47 +02:00
Earl Warren
d59ed64345
fix(release): golang:1.22-alpine3.20 does not have all architectures
It was premature to try to use them, try again later.

https://codeberg.org/forgejo-integration/forgejo/actions/runs/2147

github.com/docker/buildx v0.14.1 59582a88fca7858dbe1886fd1556b2a0d79e43a3
::endgroup::
[command]/usr/bin/docker buildx build --build-arg RELEASE_VERSION=8.0-test --file Dockerfile --iidfile /tmp/docker-actions-toolkit-UzuWxS/iidfile --platform linux/amd64,linux/arm64,linux/arm/v6 --tag codeberg.org/***/forgejo:8.0-test --metadata-file /tmp/docker-actions-toolkit-UzuWxS/metadata-file --push .
------
 > [linux/arm/v6 internal] load metadata for code.forgejo.org/oci/golang:1.22-alpine3.20:
------
Dockerfile:3
--------------------
   1 |     FROM --platform=$BUILDPLATFORM docker.io/tonistiigi/xx AS xx
   2 |
   3 | >>> FROM --platform=$BUILDPLATFORM code.forgejo.org/oci/golang:1.22-alpine3.20 as build-env
   4 |
   5 |     ARG GOPROXY
--------------------
Dockerfile:1
--------------------
   1 | >>> FROM --platform=$BUILDPLATFORM docker.io/tonistiigi/xx AS xx
   2 |
   3 |     FROM --platform=$BUILDPLATFORM code.forgejo.org/oci/golang:1.22-alpine3.20 as build-env
--------------------
Dockerfile:54
--------------------
  52 |     RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete
  53 |
  54 | >>> FROM code.forgejo.org/oci/golang:1.22-alpine3.20
  55 |     ARG RELEASE_VERSION
  56 |     LABEL maintainer="contact@forgejo.org" \
--------------------
ERROR: failed to solve: code.forgejo.org/oci/golang:1.22-alpine3.20: failed to resolve source metadata for code.forgejo.org/oci/golang:1.22-alpine3.20: no match for platform in manifest: not found
::error::buildx failed with: ERROR: failed to solve: code.forgejo.org/oci/golang:1.22-alpine3.20: failed to resolve source metadata for code.forgejo.org/oci/golang:1.22-alpine3.20: no match for platform in manifest: not found
2024-05-26 21:51:57 +02:00
Earl Warren
041932ed01
feat(release): fetch OCI alpine images from code.forgejo.org/oci
Use code.forgejo.org/oci instead of docker.io
so that builds are not subject to rate-limiting when debugging.

The mirrored images are updated daily

https://code.forgejo.org/forgejo/oci-mirror/src/branch/main/.forgejo/workflows/mirror.yml
2024-05-25 08:55:31 +02:00
Gerard Salvatella
dad16cd589 fix(Dockerfile.rootless): revert to default path for app.ini
The current path of the `$GITEA_APP_INI` configuration file makes the
forgejo application reset every time the container is restarted, unless
a specific volume for this file is created. Consider the following:

* This quirk is not documented
* All configuration data resides in `/var/lib/gitea`
* The custom configuration path defaults to `/var/lib/gitea/custom/conf`
  (see `forgejo -h`)
* Containers mounting the volume `-v /foo/bar:/var/lib/gitea` already
  have this file available to modify. Another volume shouldn't be
  required
* Containers using named volumes can use `docker cp` to modify the file
  inside the volume, if desired

For these reasons, it makes more sense to use the default path for
`$GITEA_APP_INI` rather than require users to create a dedicated volume
for the file. Revert it back to its default while maintaining backwards
compatibility (users can update by simply moving the file to the new
path).
2024-04-26 21:30:10 +02:00
Earl Warren
028d19c0fe
feat(release): add OCI labels to container images 2024-04-16 17:50:57 +02:00
Earl Warren
06e27e31c2
go: upgrade to go v1.22 - Dockerfile* 2024-03-26 06:48:32 +01:00
Earl Warren
004b772b5c
[RELEASE] cache node_modules 2024-02-19 14:18:26 +01:00
Earl Warren
014e533206
[RELEASE] decouple the release name from the version number
The release name, as provided by FORGEJO_RELEASE, is used to build OCI
images and binary files. Although it can be the same as the Forgejo
version, it is not a requirement.

When the FORGEJO_RELEASE environment variable is set, use it as a
default for naming the binary file instead of FORGEJO_VERSION. For
instance, when building from the forgejo branch here is what is desired:

FORGEJO_VERSION=7.0.0-g2343
GITEA_VERSION=1.22.0
VERSION=vforgejo-test

The name of the release is also displayed with forgejo --version
for sanity check purposes.

Before:

FORGEJO_VERSION is the computed version
GITEA_VERSION is set manually
VERSION defaults to FORGEJO_VERSION
forgejo --help does not display VERSION

After:

FORGEJO_VERSION is the computed version
GITEA_VERSION is set manually
RELEASE_VERSION defaults to FORGEJO_VERSION
VERSION defaults to RELEASE_VERSION
forgejo --help displays VERSION
2024-02-17 15:27:35 +01:00
Earl Warren
cb786f0d40
[CI] Forgejo Actions based release process
Refs: https://codeberg.org/forgejo/website/pulls/230
(cherry picked from commit 87d56bf6c7)

[CI] Forgejo Actions based release process (squash)

base64 -w0 to avoid wrapping when the doer name is long as it creates
a broken config.json

(cherry picked from commit 9efdc27e49)

[CI] Forgejo Actions based release process (squash) generate .xz files and sources

Generate .xz files
Check .sha256
Generate the source tarbal

(cherry picked from commit 7afec520c4)

[CI] Forgejo Actions based release process (squash) release notes

(cherry picked from commit d8f4f4807b)

[CI] Forgejo Actions based release process (squash) publish and sign release

(cherry picked from commit a52778c747)
(cherry picked from commit cf2ec62740)

[CI] Forgejo Actions based release process (squash) version

use Actions environment variables in Makefile (#25319) (#25318)

uses Actions variable to determine the version. But Forgejo builds
happen in a container where they are not available. Do not use them.

Also verify the version of the binary is as expected for sanity check.

(cherry picked from commit 6decf111a1)
(cherry picked from commit 206d0b3886)

[CI] read STORED_VERSION_FILE if available

(cherry picked from commit af74085ebf)

[CI] backward compatible executable compilation

Add a new static-executable target to use in Dockerfiles and restore
the $(EXECUTABLE) target to what it was before to for backward
compatibility.

The release process now builds static executables instead of
dynamically linked ones which makes them more portable. It changes the
requirements at compile time and is not backward compatible. In
particular it may break packaging that rely on the target that
currently creates a dynamically linked executable.

(cherry picked from commit 84d02a174a)
(cherry picked from commit 854be47328)

[CI] Forgejo Actions based release process (squash) doc / ca / verbosity

- Document workflow
- Increase verbosity if VERBOSE=true
- Download the Certificate Authority if behind the VPN

(cherry picked from commit 168d5d5869)
(cherry picked from commit 8756c9a72a)
(cherry picked from commit 2dad7ef20f)

[CI] Forgejo Actions based release process (squash) add assets sources-tarbal

Refs: https://codeberg.org/forgejo/forgejo/issues/1115
(cherry picked from commit 5531d01f19)

[CI] Forgejo Actions based release process (squash) add assets sources-tarbal

bindata.go is a file, not a directory

Refs: https://codeberg.org/forgejo/forgejo/issues/1115
(cherry picked from commit bd88a44778)
(cherry picked from commit b408085138)

[CI] Forgejo Actions based release process (squash) public/assets moved

(cherry picked from commit d8c921d5a6)
(cherry picked from commit f29e50b1a09b1a22fc2dbdb77e9a1def1196175b)

[CI] Fix release notes link

- Use substitution to replace all dots with dashes.
- Resolves https://codeberg.org/forgejo/forgejo/issues/1163

(cherry picked from commit 96783728f53a072915cace392aa269adfe9a5c73)
(cherry picked from commit c8d8bf8996)

[CI] pin go v1.20 for testing

Refs: https://codeberg.org/forgejo/forgejo/issues/1228
(cherry picked from commit fd4b5a013e)
(cherry picked from commit 00bb15f57f)

Conflicts:
	Dockerfile
	Dockerfile.rootless
	see https://codeberg.org/forgejo/forgejo/pulls/1303
(cherry picked from commit 6e2be54a6d)
(cherry picked from commit 346c418b4a)
(cherry picked from commit 49061f8422)
(cherry picked from commit 8229d59b7e)
(cherry picked from commit 70d45d9193)

[CI] Forgejo Actions based release process (squash) need node 18

(cherry picked from commit 722b1f4590)
(cherry picked from commit a91d786169)

[CI] Forgejo Actions based release process (squash) fix indentation

(cherry picked from commit fbdf9d6abb)
(cherry picked from commit 2deff90a13)
(cherry picked from commit 5710a27fda)

[CI] Forgejo Actions based release process (squash) FQIN for docker

Refs: https://codeberg.org/forgejo/forgejo/issues/1600
(cherry picked from commit f63d38deb6)

[CI] Forgejo Actions based release process (squash) use forgejo-curl.sh

(cherry picked from commit c0c3ef506f)
(cherry picked from commit 933ca7ec5d)

Conflicts:
	Dockerfile
	Dockerfile.rootless
	https://codeberg.org/forgejo/forgejo/pulls/1691
(cherry picked from commit 1068e48805)

[CI] Forgejo Actions based release process (squash) size optimization

(cherry picked from commit 3c653ff742)
(cherry picked from commit 398567fc0c)
(cherry picked from commit e585db9a97)
(cherry picked from commit 17e91c96e3)

[CI] Forgejo Actions based release process (squash) gitea to forgejo

(cherry picked from commit 9c06a318b8)
(cherry picked from commit 95859da3b4)
(cherry picked from commit e3a5f6c1ed)
(cherry picked from commit 7b9b259c75)
(cherry picked from commit c4a152c8dc)
(cherry picked from commit b00bf599ef)
(cherry picked from commit a7836ee2ee)
(cherry picked from commit 3ea7dcbd5b)
(cherry picked from commit 454d705e83)
(cherry picked from commit 35e06c3009)
(cherry picked from commit 904468a38f)
(cherry picked from commit 890e86815a)
(cherry picked from commit bf9f94c63d)
(cherry picked from commit d025d061d1)
(cherry picked from commit 32f209a8e1)
(cherry picked from commit 38ef6802fc)
(cherry picked from commit 8a19bbd2a8)
(cherry picked from commit f352dee786)
(cherry picked from commit b53d9fc090)
(cherry picked from commit 3dae21f4c8)
(cherry picked from commit 8b59e016c7)
(cherry picked from commit 6f54ea6a0e)
(cherry picked from commit ed8d90de6b)
(cherry picked from commit 26ffd3fcac)
(cherry picked from commit 287b3bbfb5)
(cherry picked from commit ab81378d0c)
(cherry picked from commit f6bbe7e875)
(cherry picked from commit 8968f34edf)
(cherry picked from commit d3d914bba2)
(cherry picked from commit 4e4006a990)
(cherry picked from commit edb333569b)
(cherry picked from commit 6c1a4baa15)
(cherry picked from commit 51bda3bfc7)
(cherry picked from commit 6f5f318b8f)
(cherry picked from commit e128da2362)
(cherry picked from commit 3e6735ff23)
(cherry picked from commit 938c444125)
(cherry picked from commit 67f92dc9ab)
(cherry picked from commit ee31df71fb)
(cherry picked from commit 386f232191)
(cherry picked from commit 745785cd7f)
(cherry picked from commit efa8564e76)

Conflicts:
	Dockerfile
	Dockerfile.rootless
	https://codeberg.org/forgejo/forgejo/pulls/2029
(cherry picked from commit f3dfb14321)
(cherry picked from commit 5a0346ee95)
(cherry picked from commit 7a2a6517f2)
(cherry picked from commit 87dcc87da9)
(cherry picked from commit df4099247f)
(cherry picked from commit df23f83545)
2024-02-05 13:33:59 +01:00
Loïc Dachary
2cee2e90dc
[CI] implementation: forgejo container images
(cherry picked from commit dd1971d4e6)
(cherry picked from commit 3981dbaf8c)
(cherry picked from commit 8dff3cc2d1)
(cherry picked from commit e7673e5d22)
(cherry picked from commit 326174064b)
(cherry picked from commit eb769dbde4)
(cherry picked from commit 335829ade2)
(cherry picked from commit 5e8e4f549d)

Conflicts:
	Dockerfile
	Dockerfile.rootless
(cherry picked from commit b777fc91d0)
(cherry picked from commit 02cda642ec)
(cherry picked from commit 96ef93f3bc)
(cherry picked from commit aa424551f2)

Conflicts:
	Dockerfile
	Dockerfile.rootless
(cherry picked from commit e54fa86e49)
(cherry picked from commit 043fa6d664)
(cherry picked from commit 805b162480)
(cherry picked from commit 86bf362a3c)
(cherry picked from commit 13e0007959)
(cherry picked from commit 00ff6f7cb3)
(cherry picked from commit 95c7d8e883)
(cherry picked from commit fb033d2bb6)
(cherry picked from commit 1147910a55)
(cherry picked from commit 6590b6e99c)
(cherry picked from commit 78938113e4)
(cherry picked from commit 57338224f172e30a72f03f565aa47876e1213e77)
(cherry picked from commit 4266cbcdd4)
(cherry picked from commit bdc766a5a2)
(cherry picked from commit 6fb9ad8504)
(cherry picked from commit c4e6383240)
(cherry picked from commit 490fa55b3a)
(cherry picked from commit 802c8e72be)
(cherry picked from commit 2b1efe2030)
(cherry picked from commit fdcdd7389a)
(cherry picked from commit b9ae491650)
(cherry picked from commit e7867c6512)
(cherry picked from commit 0a43263fa6)
(cherry picked from commit 64bb6b8982)
(cherry picked from commit dcc1fd6292)
(cherry picked from commit b0250fd533)
(cherry picked from commit 427b059996)
(cherry picked from commit b6058e28cb)
(cherry picked from commit b91a41dd79)
(cherry picked from commit b8bcb22726)
(cherry picked from commit 69ae87f11f)

Conflicts:
	Dockerfile
	Dockerfile.rootless
	https://codeberg.org/forgejo/forgejo/pulls/2029
(cherry picked from commit a4a846a8d5)
(cherry picked from commit a1a947ce03)
(cherry picked from commit 55bd48007f)
(cherry picked from commit f012eb7cb0)
(cherry picked from commit 59d0824a3d)
(cherry picked from commit 59a797db40)
2024-02-05 13:33:58 +01:00
techknowlogick
a1d2a152f8
bump to use alpine3.19 (#28594) 2023-12-23 21:04:58 +00:00
Patryk Krawaczyński
319414dd82
Dockerfile small refactor (#27757)
- Size and layer optimization,
- Maintaining consistency in definitions (comments, apk etc.),
2023-10-29 09:44:06 +08:00
techknowlogick
653e77fd22
bump go to 1.21 (#26608)
Co-authored-by: Giteabot <teabot@gitea.io>
2023-08-21 00:27:46 +02:00
Yevhen Pavlov
bed6885448
Update to Alpine 3.18 (#24700)
This pull request is for updating the base docker images to build with the latest version of Alpine.
2023-05-14 01:49:00 +00:00
techknowlogick
6148e38b86
Hardcode path to docker images (#23955)
Fix #23954

This allows for building on platforms that don't have docker hub as the
default container registry.
2023-04-07 02:41:49 -04:00
zeripath
43405c35f0
Add Bash and Zsh completion scripts (#22646)
This PR adds contrib scripts for bash and zsh completion.

Simply call:

```bash
source contrib/autocompletion/bash_autocomplete
```

or for Zsh:

```bash
source contrib/autocompletion/zsh_autocomplete
```

Signed-off-by: Andrew Thornton <art27@cantab.net>

---------

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: a1012112796 <1012112796@qq.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2023-02-21 12:32:24 -05:00
techknowlogick
cfb1cb1168
update to build with go1.20 (#22732)
as title

---------

Co-authored-by: Lauris BH <lauris@nix.lv>
2023-02-03 11:23:52 -05:00
Michael Kriese
84d2a820e5
Add dumb-init to rootless docker (#21775)
Add dumb-init as process reaper to the rootless image to reap defunct git processes.
2022-12-04 11:12:06 +00:00
flynnnnnnnnnn
350bc83d00
Update to Alpine 3.17 (#21904)
This pull request is for updating the base docker images to build with
the latest version of Alpine.
2022-12-02 11:23:26 -05:00
techknowlogick
be824890e4
Switch to building with go1.19 (#20695) 2022-08-07 12:25:03 -04:00
luzpaz
d29d6d1991
Fix various typos (#20338)
* Fix various typos

Found via `codespell -q 3 -S ./options/locale,./options/license,./public/vendor -L actived,allways,attachements,ba,befores,commiter,pullrequest,pullrequests,readby,splitted,te,unknwon`

Co-authored-by: zeripath <art27@cantab.net>
2022-07-12 23:32:37 +02:00
techknowlogick
0cbec3cd37
alpine 3.16 (#19797)
Co-authored-by: 6543 <6543@obermui.de>
2022-05-25 07:42:28 +03:00
techknowlogick
ed1d95c55d
use go1.18 to build gitea (#19099)
* use go1.18 to build gitea& update min go version to 1.17

* bump in a few more places

* add a few simple tests for isipprivate

* update go.mod

* update URL to https://go.dev/dl/

* golangci-lint

* attempt golangci-lint workaround

* change version

* bump fumpt version

* skip strings.title test

* go mod tidy

* update tests as some aren't private??

* update tests
2022-03-16 00:08:31 -04:00
Grzegorz Alibożek
4563148a61
Upgrade Alpine from 3.13 to 3.15 (#18050)
* Upgrade alpine to 3.15

* Add executability test to entrypoint for too old dockers

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Update docker/rootless/usr/local/bin/docker-entrypoint.sh

Co-authored-by: zeripath <art27@cantab.net>
2022-01-19 16:55:17 -05:00
techknowlogick
d8ae769dda
update docker image to latest go version (#18048) 2021-12-20 22:11:10 -05:00
zeripath
7d0629adf8
Use shadowing script for docker (#17846)
Too many docker users are caught out by the default location for the
app.ini file being environment dependent so that when they docker exec
into the container the gitea commands do not work properly and require
additional -c arguments to correctly pick up the configuration.

This PR simply shadows the gitea binary using variants of the FHS
compatible script to make the command gitea have the default locations
by default.

Fix #14468
Reference #17497
Reference #12082
Reference #8941
... amongst others ...
Replace #17501

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-12-01 18:08:27 +00:00
wxiaoguang
6e2c64f27a
Fix docker rootless build (#17441) 2021-10-26 17:21:01 +01:00
zeripath
0277603878
chmod executables when copying to the docker (#17423)
Run chmod on the executables and the entrypoint when copying them to the
docker in dockerfile.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Norwin <noerw@users.noreply.github.com>
Co-authored-by: delvh <dev.lh@web.de>
2021-10-25 20:32:03 +02:00
techknowlogick
274aeb3a9e
build with go1.17 (#16707)
Co-authored-by: Lauris BH <lauris@nix.lv>
2021-08-17 08:31:28 -04:00
techknowlogick
7b31aae414
revert to use alpine 3.13 (#16451)
Co-authored-by: zeripath <art27@cantab.net>
2021-07-16 09:54:39 +08:00
Jonathan Hult
615444dcbd
Fix #16387 - rootless Docker user (#16388)
Move comment to top of USER instruction
2021-07-09 10:08:22 -04:00
Tobias Florek
5e819ee1de
specify user in rootless container numerically (#16361)
* specify user in rootless container numerically

With kubernetes' PodSecurityPolicy set to runAsNonRoot it will not allow starting the container.  The error message is
```
Error: container has runAsNonRoot and image has non-numeric user (git), cannot verify user is non-root
```
The `USER` directive has to be numerical for that to work.

* mention the name of the uid/gid

Co-authored-by: 6543 <6543@obermui.de>
2021-07-08 15:30:09 -04:00
techknowlogick
061a8e7bb9
Alpine 3.14 released (#16170)
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: zeripath <art27@cantab.net>
2021-07-07 15:43:00 -04:00
Steven
683cfe39ef
Change default TMPDIR path in rootless containers (#16077)
Signed-off-by: Steven Kriegler <61625851+justusbunsi@users.noreply.github.com>
2021-06-06 00:04:56 +02:00
Steven
d6d2444f2a
Add curl to rootless docker image (#15908)
Signed-off-by: JustusBunsi <61625851+justusbunsi@users.noreply.github.com>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-05-21 00:03:41 -04:00
Martin Michaelis
d576126286
Remove random password in Dockerfiles (#15362)
* Remove random password of git user in dockerfile

* Disable git user account in rootless dockerfile
2021-04-29 19:48:52 +02:00
techknowlogick
47f6a4ec3f
go1.16 (#14783) 2021-02-28 18:08:33 -05:00
Kyle D
61f347e349
Add environment-to-ini to docker image (#14762)
* Add environment-to-app.ini routine

* Call environment-to-ini in docker setup scripts

* Automatically convert section vars to lower case to match documentation

* Remove git patch instructions

* Add env variable documentation to Install Docker
2021-02-23 20:21:44 +01:00
techknowlogick
b708968694
upgrade to alpine 3.13 (#14343) 2021-01-20 05:21:01 +01:00
Lauris BH
8c2b5feeae
When building rootless docker image move chown&chmod to build stage (#13578)
* When building rootless docker image move chown&chmod to build stage

Fixes #13577

* Fix command newlines

* Move chown to COPY command

* Seems to be working also without chmod

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-11-15 20:44:41 -05:00
Antoine GIRARD
fe458ce877
docker: rootless image (#10154)
* docker: rootless image

* improve docs + remove check for write perm on custom

* add more info on ssh passtrough

* Add comment for internal ssh server in container config
2020-10-31 20:58:22 -04:00