diff --git a/.github/workflows/docker-alpine.yml b/.github/workflows/docker-alpine.yml index 4fc79a3..2bc76ab 100644 --- a/.github/workflows/docker-alpine.yml +++ b/.github/workflows/docker-alpine.yml @@ -50,5 +50,7 @@ jobs: file: ./Dockerfile push: true platforms: linux/amd64,linux/arm64 + build-args: | + API_RATE_URL=${{ vars.API_RATE_URL }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile index 72b7e82..a70b81a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ENV CGO_ENABLED=0 WORKDIR /app -RUN git clone https://github.com/GMwalletApp/epusdt.git . +COPY . /app WORKDIR /app/src RUN go mod download @@ -14,11 +14,15 @@ RUN go build -o /app/epusdt . FROM alpine:latest AS runner ENV TZ=Asia/Shanghai RUN apk --no-cache add ca-certificates tzdata +ARG API_RATE_URL="" WORKDIR /app COPY --from=builder /app/src/static /app/static COPY --from=builder /app/src/static /static COPY --from=builder /app/src/.env.example /app/.env +RUN if [ -n "$API_RATE_URL" ]; then \ + sed -i "s|^api_rate_url=.*$|api_rate_url=${API_RATE_URL}|" /app/.env; \ + fi COPY --from=builder /app/epusdt . VOLUME /app/conf