Skip to content

Commit

Permalink
增加docker-compose方式构建
Browse files Browse the repository at this point in the history
  • Loading branch information
assimon committed Nov 15, 2023
1 parent 956f756 commit c4c5393
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3,294 deletions.
37 changes: 25 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
FROM debian:bullseye-slim
RUN apt-get update -y \
&& apt-get install -y libsqlite3-dev \
&& apt-get install -y sqlite3 \
&& apt-get install -y libc6 \
&& apt-get install -y libc6-dev \
&& apt-get install -y musl
RUN mkdir -p /app/db
ADD config.toml /app/
ADD captcha-bot /app/
ADD cacert.pem /etc/ssl/certs/
FROM golang:latest as builder

WORKDIR /app
ENTRYPOINT ["./captcha-bot"]

COPY . .

RUN apt-get update && apt-get install -y musl-tools

ENV CGO_ENABLED=1 \
GOOS=linux \
GOARCH=amd64 \
CC=x86_64-linux-musl-gcc \
CXX=x86_64-linux-musl-g++ \
GOPROXY=https://goproxy.cn,direct

RUN go mod download
RUN go mod verify
RUN go build -ldflags '-linkmode external -extldflags "-static"' -o captcha-bot

FROM alpine:latest

COPY --from=builder /app/captcha-bot /work/captcha-bot

WORKDIR /work

ENTRYPOINT ["./captcha-bot"]
Loading

0 comments on commit c4c5393

Please sign in to comment.