Skip to content

Commit c257293

Browse files
fix(docker): runtime error
1 parent 786c6d1 commit c257293

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ FROM golang:1.21 AS builder
22
RUN apt-get update && apt-get upgrade -y && apt-get install build-essential -y
33
WORKDIR /app
44
COPY . .
5-
RUN CGO_ENABLED=0 GOOS=`go env GOHOSTOS` GOARCH=`go env GOHOSTARCH` go build ./cmd/fsb/ -o out/fsb -ldflags="-w -s" .
5+
RUN CGO_ENABLED=0 go build -o /app/fsb -ldflags="-w -s" ./cmd/fsb
66

7-
FROM golang:1.21
8-
COPY --from=builder /app/out/fsb /app/fsb
9-
CMD ["/app/fsb"]
7+
FROM scratch
8+
COPY --from=builder /app/fsb /app/fsb
9+
EXPOSE ${PORT}
10+
ENTRYPOINT ["/app/fsb"]

docker-compose.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ services:
55
build:
66
context: .
77
dockerfile: Dockerfile
8-
restart: always
98
container_name: fsb
9+
restart: always
1010
volumes:
11-
- ./:/app/:rw
12-
env_file: fsb.env
11+
- ./logs:/app/logs
12+
env_file:
13+
- fsb.env
1314
ports:
14-
- 8080:8080
15+
- "${PORT:-8038}:${PORT:-8038}"

0 commit comments

Comments
 (0)