Skip to content

Commit

Permalink
build(ci+docker): fix pgo build
Browse files Browse the repository at this point in the history
  • Loading branch information
dwisiswant0 committed Oct 6, 2023
1 parent 1b0b79f commit 1af46a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@ jobs:
- uses: docker/[email protected]
with:
push: true
build-args: "VERSION=${{ inputs.tag || github.ref_name }},PGO_FILE=${{ github.workspace }}/default.pgo"
build-args: "VERSION=${{ inputs.tag || github.ref_name }}"
tags: "ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ inputs.tag || github.ref_name }}"
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.19-alpine AS build
FROM golang:alpine AS build

ARG VERSION="docker"
ARG LDFLAGS="-s -w -X github.com/kitabisa/teler-proxy/common.Version=${VERSION}"
Expand All @@ -9,13 +9,15 @@ LABEL repository="https://github.com/kitabisa/teler-proxy"
LABEL maintainer="dwisiswant0"

WORKDIR /app
COPY ./go.mod .
COPY ["go.mod", "."]
COPY ["${PGO_FILE}", "./default.pgo"]
RUN go mod download

RUN apk add build-base

COPY . .
RUN CGO_ENABLED="1" go build -pgo "${PGO_FILE}" -ldflags "${LDFLAGS}" \
RUN CGO_ENABLED="1" go build \
-pgo "default.pgo" -ldflags "${LDFLAGS}" \
-o ./bin/teler-proxy ./cmd/teler-proxy

FROM alpine:latest
Expand Down

0 comments on commit 1af46a9

Please sign in to comment.