Skip to content

Commit 5bd25bb

Browse files
committed
Docker build successful
Note, docker build is only factored for development, as it still requires a .env file. Hosting service would determine a final build for production. Signed-off-by: tobigiwa <[email protected]>
1 parent 88ab301 commit 5bd25bb

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bin/

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
bin/
1+
bin/
2+
vendor/

Dockerfile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,21 @@ LABEL maintainer = "Giwa Oluwatobi, [email protected]"
44

55
WORKDIR /app
66

7-
COPY . /app
7+
COPY go.mod go.sum ./
88

9-
RUN go mod tidy
10-
RUN go build -o bin/BlockRide cmd/blockride/main.go
9+
# vendoring instead
10+
# RUN go mod download
11+
12+
COPY . .
13+
14+
RUN CGO_ENABLED=0 GOOS=linux go build -mod vendor -o /app/blockride cmd/blockride/main.go
1115

1216
FROM alpine
1317

14-
WORKDIR /root/
18+
WORKDIR /
19+
20+
COPY --from=builder /app/blockride /blockride
1521

16-
COPY --from=builder /app/bin/BlockRide /root/
22+
RUN chmod +x blockride
1723

18-
CMD ./BlockRide
24+
ENTRYPOINT [ "/blockride" ]

0 commit comments

Comments
 (0)