mirror of
https://github.com/beego/bee.git
synced 2024-11-22 15:10:54 +00:00
updated Dockerfile template
This commit is contained in:
parent
c562cedf96
commit
e3de9ed86d
@ -29,22 +29,23 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const dockerBuildTemplate = `FROM {{.BaseImage}}
|
const dockerBuildTemplate = `FROM {{.BaseImage}}
|
||||||
|
RUN apt-get update
|
||||||
# Godep for vendoring
|
RUN apt-get install -y go-dep
|
||||||
RUN go get github.com/tools/godep
|
|
||||||
|
|
||||||
# Recompile the standard library without CGO
|
# Recompile the standard library without CGO
|
||||||
RUN CGO_ENABLED=0 go install -a std
|
RUN CGO_ENABLED=0 go install -a std
|
||||||
|
|
||||||
ENV APP_DIR $GOPATH{{.Appdir}}
|
WORKDIR $GOPATH{{.Appdir}}
|
||||||
RUN mkdir -p $APP_DIR
|
COPY . .
|
||||||
|
|
||||||
# Set the entrypoint
|
|
||||||
ENTRYPOINT (cd $APP_DIR && ./{{.Entrypoint}})
|
|
||||||
ADD . $APP_DIR
|
|
||||||
|
|
||||||
# Compile the binary and statically link
|
# Compile the binary and statically link
|
||||||
RUN cd $APP_DIR && CGO_ENABLED=0 godep go build -ldflags '-d -w -s'
|
RUN dep init
|
||||||
|
# RUN dep ensure
|
||||||
|
RUN go mod vendor
|
||||||
|
RUN CGO_ENABLED=0 go build -ldflags '-d -w -s'
|
||||||
|
|
||||||
|
# Set the entrypoint
|
||||||
|
ENTRYPOINT ./{{.Entrypoint}}
|
||||||
|
|
||||||
EXPOSE {{.Expose}}
|
EXPOSE {{.Expose}}
|
||||||
`
|
`
|
||||||
@ -62,7 +63,7 @@ var CmdDockerize = &commands.Command{
|
|||||||
UsageLine: "dockerize",
|
UsageLine: "dockerize",
|
||||||
Short: "Generates a Dockerfile for your Beego application",
|
Short: "Generates a Dockerfile for your Beego application",
|
||||||
Long: `Dockerize generates a Dockerfile for your Beego Web Application.
|
Long: `Dockerize generates a Dockerfile for your Beego Web Application.
|
||||||
The Dockerfile will compile, get the dependencies with {{"godep"|bold}}, and set the entrypoint.
|
The Dockerfile will compile, get the dependencies with {{"dep"|bold}}, and set the entrypoint.
|
||||||
|
|
||||||
{{"Example:"|bold}}
|
{{"Example:"|bold}}
|
||||||
$ bee dockerize -expose="3000,80,25"
|
$ bee dockerize -expose="3000,80,25"
|
||||||
|
Loading…
Reference in New Issue
Block a user