From d0977ba29085f676b06490d299a5825a11efb536 Mon Sep 17 00:00:00 2001 From: Cristopher Namchee Date: Wed, 20 Dec 2023 16:25:18 +0700 Subject: [PATCH 1/5] refactor: test out new build process --- Dockerfile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 55fe066..38af3c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.18 +FROM golang:1.18 as builder WORKDIR /ci @@ -9,8 +9,14 @@ RUN go mod download COPY . . -RUN go build -a -o cpr . +ENV GOCACHE=/root/.cache/go-build +RUN --mount=type=cache,target="/root/.cache/go-build" go build -o cpr . -RUN chmod +x /ci/cpr +FROM ubuntu:22.04 -CMD ["/ci/cpr"] +RUN mkdir /app +WORKDIR /app + +COPY --from=builder /ci/cpr . + +ENTRYPOINT ["/cpr"] From 5995c5dac25a0e67dc72b32637bd246b14391a07 Mon Sep 17 00:00:00 2001 From: Cristopher Namchee Date: Wed, 20 Dec 2023 16:30:49 +0700 Subject: [PATCH 2/5] chore: temporarily change event to normal pull_request --- .github/workflows/cpr.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/cpr.yml b/.github/workflows/cpr.yml index c4f443e..0218323 100644 --- a/.github/workflows/cpr.yml +++ b/.github/workflows/cpr.yml @@ -1,7 +1,7 @@ name: Check PR semantics on: - pull_request_target: + pull_request: jobs: cpr: @@ -12,5 +12,3 @@ jobs: uses: ./ with: access_token: ${{ secrets.ACCESS_TOKEN }} - edit: true - verbose: true From f424225e4094c61af120ed8999afec52d789f6d8 Mon Sep 17 00:00:00 2001 From: Cristopher Namchee Date: Wed, 20 Dec 2023 16:32:30 +0700 Subject: [PATCH 3/5] fix: add relative path indicator to docker entrypoint --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 38af3c3..581d790 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,4 +19,4 @@ WORKDIR /app COPY --from=builder /ci/cpr . -ENTRYPOINT ["/cpr"] +ENTRYPOINT ["./cpr"] From 4538dee786e4e54351d59cc4305f49296ef8b9cd Mon Sep 17 00:00:00 2001 From: Cristopher Namchee Date: Wed, 20 Dec 2023 18:00:42 +0700 Subject: [PATCH 4/5] fix: state the name directly --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 581d790..1f4da3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,6 @@ FROM ubuntu:22.04 RUN mkdir /app WORKDIR /app -COPY --from=builder /ci/cpr . +COPY --from=builder /ci/cpr /app/cpr -ENTRYPOINT ["./cpr"] +ENTRYPOINT ["/app/cpr"] From 868a7f3372088e8112ecdd76dab43bc436fdb093 Mon Sep 17 00:00:00 2001 From: Cristopher Namchee Date: Wed, 20 Dec 2023 18:10:12 +0700 Subject: [PATCH 5/5] fix(action): install CA --- .github/workflows/cpr.yml | 3 ++- Dockerfile | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cpr.yml b/.github/workflows/cpr.yml index 0218323..8c26cb3 100644 --- a/.github/workflows/cpr.yml +++ b/.github/workflows/cpr.yml @@ -1,7 +1,7 @@ name: Check PR semantics on: - pull_request: + pull_request_target: jobs: cpr: @@ -12,3 +12,4 @@ jobs: uses: ./ with: access_token: ${{ secrets.ACCESS_TOKEN }} + diff --git a/Dockerfile b/Dockerfile index 1f4da3a..75c9cfe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,8 @@ FROM ubuntu:22.04 RUN mkdir /app WORKDIR /app +RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates + COPY --from=builder /ci/cpr /app/cpr ENTRYPOINT ["/app/cpr"]