Fix Dockerfile to build Go application with correct module setup and port configuration.
This commit is contained in:
parent
574ea58b95
commit
8f3a063752
|
@ -12,17 +12,27 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
FROM golang:1.10.0
|
FROM golang:1.18 AS builder
|
||||||
|
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
|
||||||
|
RUN go mod init temp-module || true
|
||||||
RUN go get github.com/codegangsta/negroni \
|
RUN go get github.com/codegangsta/negroni \
|
||||||
github.com/gorilla/mux \
|
github.com/gorilla/mux \
|
||||||
github.com/xyproto/simpleredis/v2
|
github.com/xyproto/simpleredis/v2
|
||||||
WORKDIR /app
|
|
||||||
ADD ./main.go .
|
|
||||||
|
COPY ./main.go .
|
||||||
|
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go build -o main .
|
RUN CGO_ENABLED=0 GOOS=linux go build -o main .
|
||||||
|
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=0 /app/main .
|
COPY --from=builder /app/main .
|
||||||
COPY ./public/index.html public/index.html
|
COPY ./public/index.html public/index.html
|
||||||
COPY ./public/script.js public/script.js
|
COPY ./public/script.js public/script.js
|
||||||
COPY ./public/style.css public/style.css
|
COPY ./public/style.css public/style.css
|
||||||
|
|
Loading…
Reference in New Issue