Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
iamjooon2 committed Sep 13, 2024
1 parent 88d9330 commit 77de15a
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
FROM golang:alpine AS builder
# syntax=docker/dockerfile:1

ENV GO111MODULE=on \
CGO_ENABLED=0 \
GOOS=linux \
GOARCH=amd64
FROM golang:1.22.5

WORKDIR /build

COPY go.mod go.sum ./cmd/main.go ./
# Set destination for COPY
WORKDIR /app

# Download Go modules
COPY go.mod go.sum ./
RUN go mod download
RUN go build -o techbloghub-server .

WORKDIR /dist

RUN cp /build/techbloghub-server .
# Copy the source code. Note the slash at the end, as explained in
# https://docs.docker.com/reference/dockerfile/#copy
COPY *.go ./

FROM scratch

COPY --from=builder /dist/techbloghub-server /techbloghub-server
# Build
RUN CGO_ENABLED=0 GOOS=linux go build -o /techbloghub

# Optional:
# To bind to a TCP port, runtime parameters must be supplied to the docker command.
# But we can document in the Dockerfile what ports
# the application is going to listen on by default.
# https://docs.docker.com/reference/dockerfile/#expose
EXPOSE 8080
ENTRYPOINT ["/techbloghub-server"]

# Run
CMD ["/techbloghub"]

0 comments on commit 77de15a

Please sign in to comment.