GithubHelp home page GithubHelp logo

Failed to Dockerize about goyave HOT 3 CLOSED

go-goyave avatar go-goyave commented on June 25, 2024
Failed to Dockerize

from goyave.

Comments (3)

System-Glitch avatar System-Glitch commented on June 25, 2024 1

Hello, I think the only problem with your Dockerfile is that you forgot WORKDIR. The config file is looked for in the working directory.

I used the following Dockerfile and it worked: (with docker-goyave as project name)

FROM golang:alpine as builder

WORKDIR /app

COPY . .

RUN go build

FROM alpine:3.9

WORKDIR /app

COPY --from=builder /go/pkg/mod/github.com/!system-!glitch/goyave/ /go/pkg/mod/github.com/!system-!glitch/goyave/
COPY --from=builder /app/docker-goyave ./docker-goyave
COPY resources /app/resources
COPY config.json ./config.json

EXPOSE 8080

ENTRYPOINT [ "./docker-goyave" ]

I should add this dockerfile to the documentation too.

I will also try to bundle default files inside the binary to avoid having to copy /go/pkg/mod/github.com/!system-!glitch/goyave/.

from goyave.

ridwankustanto avatar ridwankustanto commented on June 25, 2024

Hey, thank you for quick response. I did set WORKDIR but I cut in the example (my bad 😅). I forgot the expose, thanks for the full example! I will try once I get home and let you know.

from goyave.

ridwankustanto avatar ridwankustanto commented on June 25, 2024

Just able to try this out, and thanks mate, it worked. Anyway, your idea about putting the default config bundle inside the binary would be great!

And now I'm gonna try to store something into the database. 🍻

from goyave.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.