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

Keeping .git folder when deploying on Heroku? #14

Closed
Unitech opened this issue Apr 23, 2015 · 4 comments
Closed

Keeping .git folder when deploying on Heroku? #14

Unitech opened this issue Apr 23, 2015 · 4 comments

Comments

@Unitech
Copy link

Unitech commented Apr 23, 2015

Hi,

Is it possible to keep the .git folder when deploying to Heroku? We need to do some processing based on the data in this folder.

heroku/legacy-cli#1509

Thanks!

@dmathieu
Copy link

Hi,

There is no way to do this at the moment. As @dickeyxxx mentioned, this would not be a very good idea either.
Furthermore, you aren't necessarily deploying from GIT. You could be using the platform API.
See https://devcenter.heroku.com/articles/build-and-release-using-the-api
So this would have a very limited usage.

What data do you need available in your deployed app?

@jdx jdx closed this as completed May 6, 2015
jdx pushed a commit that referenced this issue Jun 19, 2018
jdx pushed a commit that referenced this issue Jun 19, 2018
Trusted IP Ranges (spaces:inboundruleset rename)
jdx added a commit that referenced this issue Jun 19, 2018
jdx pushed a commit that referenced this issue Jun 19, 2018
Find attachment on context app when using add-on name/id
jdx pushed a commit that referenced this issue Jun 19, 2018
Change the build commands to ONBUILD
jdx pushed a commit that referenced this issue Jun 19, 2018
Disable node-foreman flag parsing
jdx pushed a commit that referenced this issue Jun 19, 2018
jdx pushed a commit that referenced this issue Jun 19, 2018
Add resource name to redis:info output.
@shackra
Copy link

shackra commented Oct 24, 2019

This would be great for using with sentry with the --auto option which then would enable associating commits with issues there.

@fordnox
Copy link

fordnox commented Jul 10, 2020

Looking for a way to build hugo static website with --enableGitInfo flag.

heroku.yml

build:
  docker:
    web: Dockerfile

Dockerfile

FROM klakegg/hugo:0.73.0-ext-alpine
COPY . /src
RUN ls -la
RUN hugo --gc --minify --enableGitInfo --destination=/target

FROM nginx
COPY --from=hugo /target /usr/share/nginx/html
CMD nginx -g 'daemon off;'

output

...
Step 5/14 : RUN ls -la
 ---> Running in d9ecd9dc7c49
total 16
drwxrwxrwx    6 root     root           140 Jul 10 22:18 .
drwxr-xr-x    1 root     root            46 Jul 10 22:18 ..
-rw-rw-r--    1 root     root            22 Jul 10 22:17 .gitignore
-rw-rw-r--    1 root     root           568 Jul 10 22:17 Dockerfile
drwxrwxr-x    2 root     root            24 Jul 10 22:17 archetypes
-rw-rw-r--    1 root     root            94 Jul 10 22:17 config.toml
drwxrwxr-x    2 root     root            22 Jul 10 22:17 content
drwxrwxr-x    2 root     root            53 Jul 10 22:17 deploy
-rw-rw-r--    1 root     root            37 Jul 10 22:17 heroku.yml
drwxrwxr-x    3 root     root            18 Jul 10 22:17 themes
Removing intermediate container d9ecd9dc7c49
 ---> c36ac5776b55
Step 6/14 : RUN hugo --gc --minify --enableGitInfo --destination=/target
 ---> Running in e1d737e9b58f
Building sites … ERROR 2020/07/10 22:18:42 Failed to read Git log: fatal: not a git repository (or any of the parent directories): .git
Total in 59 ms
Error: Error building site: logged 1 error(s)
The command '/bin/sh -c hugo --gc --minify --enableGitInfo --destination=/target' returned a non-zero code: 255

the problem is that there is no .git folder in slug. Pages can not be built with metadata from .git

Any hints?

@fordnox
Copy link

fordnox commented Jul 10, 2020

found walkaround

FROM klakegg/hugo:0.73.0-ext-alpine as hugo
WORKDIR /source
RUN git clone https://github.com/fordnox/pixub.git . && \
    ls -la && \
    hugo --gc --minify --enableGitInfo --destination=/target

FROM nginx
COPY deploy/default.conf.template /etc/nginx/conf.d/default.conf.template
COPY deploy/nginx.conf /etc/nginx/nginx.conf
COPY --from=hugo /target /usr/share/nginx/html
CMD /bin/sh -c "envsubst '\$PORT' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf" && nginx -g 'daemon off;'

not pretty but it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants