Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Build issue (cross-build) after moving to time/tzdata for timezone in docker #13070

Open
2 tasks done
gioboske opened this issue Oct 7, 2020 · 11 comments
Open
2 tasks done
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile type/bug

Comments

@gioboske
Copy link

gioboske commented Oct 7, 2020

  • Gitea version (or commit ref): 14e7186 (onwards)
  • Git version: not relevant
  • Operating system: docker on macOS for arm32v6/v7 cross build
  • Database (use [x]):
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Not relevant
  • Log gist:

Description

After changing the Dockerfile to use time/tzdata for timezone in docker (#12922), trying to cross-build the docker image for arm32 (host macOS, target linux/arm/v6 or v7) fails with the following error:

[...]
# code.gitea.io/gitea
time/tzdata.init.0: unresolved inter-package jump to time.registerLoadFromEmbeddedTZData(time) from time/tzdata
make: *** [Makefile:553: gitea] Error 2
The command '/bin/sh -c if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi  && make clean-all build' returned a non-zero code: 2
make: *** [build] Error 2

Oddly, the cross-compilation for arm64 raise no error and the resulting image is fully functional.

Not sure if the issue is related to the golang:1.15-alpine3.12 image used as build environment, if it is related to QEMU or if it is related to gitea itself.

Changing back the docker file by removing timetzdata from ENV TAGS (in the build environment image) and adding again the tzdata package to the final image seems to solve the issue.

It would be great to rely on a single Dockerfile both for native and cross-compilation, so to keep any docker image building as simple as docker build --platform xxxx/xxx --build-arg XXX -t image:tag gitea.

Thank you for your support!

@6543 6543 added topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile type/bug labels Oct 12, 2020
@bolet
Copy link

bolet commented Oct 13, 2020

QEMU is not the cause here.

I confirm this bug also happens when building :

  • natively on an arm32v7 board
  • using golang:alpine (without specifying versions)

Your workaround works in this case too (many thanks).

@6543
Copy link
Member

6543 commented Oct 13, 2020

@techknowlogick any idear?

@darcato
Copy link

darcato commented Nov 18, 2020

I can confirm this problem while building the image with an arm32 based QNAP nas. (TS-231P2).

@jonim8or
Copy link

I have this same problem when building on a raspberry pi 4 with raspbian (armv71, 32 bit). For me doing the reverse of #12922 makes the build work again

@gioboske
Copy link
Author

I have this same problem when building on a raspberry pi 4 with raspbian (armv71, 32 bit). For me doing the reverse of #12922 makes the build work again

I basically agree with you, but I guess it would mean giving up the possibility to embed the timezone database into gitea, using the new package included in go1.15.
However, I'm not really skilled on that, so maybe it is better to wait for the feedback of the gitea develop team...

@6543
Copy link
Member

6543 commented Nov 24, 2020

I see two points: revert 12922 and/or fix arm x32 issue in go upstream

@bolet
Copy link

bolet commented Nov 24, 2020

AFAIK, some docker images use the timezone of the host machine (via some clever /etc/x mappings) and avoid 800KB of overhead : https://golang.org/doc/go1.15#time/tzdata For ARM boards this can make a difference. I'd love to see build time options to chose the way timezone works in gitea.

@gioboske
Copy link
Author

gioboske commented Nov 24, 2020

@bolet: so (just for my understanding, again sorry I'm not so skilled on that), your proposal would be to support different options, such as:

option 1 (avoiding 800KB overhead)

  • neither import _ "time/tzdata" nor -tags timetzdata
  • no need to install tzdata in the gitea docker image
  • but include some magic bind mount to expose timezone database from docker host

option 2 (timezone db in docker image)

option 3 (embedding the timezone database at build time)

  • embedding tzdata as per current Dockerfile
  • but first need to fix arm x32 issue in go upstream

Is my understanding correct?

@bolet
Copy link

bolet commented Nov 25, 2020

@gioboske Yes, I think you summed it all pretty well.

@stale
Copy link

stale bot commented Jan 24, 2021

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale stale bot added the issue/stale label Jan 24, 2021
@OCram85
Copy link
Contributor

OCram85 commented Jan 30, 2021

Damn, #12922 killed the simplest way to build gitea loacally on a arm7 (armhf) based Raspi 4. Up to this point it was really simple to buld the temporary disabled arm7 build:

version: "3.3"
services:
  gitea:
    container_name: gitea
    build:
      context: https://github.com/go-gitea/gitea.git#release/v1.12
    image: ocram85/gitea:1.12 
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - DB_TYPE=postgres
      - DB_HOST=gitea_db:5432
      - DB_NAME=1234
      - DB_USER=g123434
      - DB_PASSWD=gitea
    restart: unless-stopped
    depends_on:
      - gitea_db
    volumes:
      - ./volumes/gitea/data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
...
...

@stale stale bot removed the issue/stale label Jan 30, 2021
@lunny lunny added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented topic/build PR changes how Gitea is built, i.e. regarding Docker or the Makefile type/bug
Projects
None yet
Development

No branches or pull requests

7 participants