Skip to content

Commit

Permalink
ci: allow dist directory in docker copy
Browse files Browse the repository at this point in the history
  • Loading branch information
k-yang committed Dec 18, 2023
1 parent 8e8daea commit 0037fef
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 24 deletions.
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
temp/
build/
dist/
*.md
10 changes: 0 additions & 10 deletions .github/workflows/goreleaser-latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,6 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Move dist to prevent dockerignore"
run: |
echo "dist contents: $(ls dist)"
if [ ! -d "dist" ]; then
echo "❌ expected dist dir to be generated from make release-snapshot" && exit 1
else echo "dist dir exists as expected."
fi
rm -rf dist-temp
cp -r dist dist-temp
- name: Build and push versioned image
uses: docker/build-push-action@v5
with:
Expand Down
4 changes: 2 additions & 2 deletions contrib/docker/goreleaser.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM golang:1.21 AS builder

WORKDIR /root
COPY ./dist-temp/ /root/
COPY ./dist/ /root/

ARG TARGETARCH
RUN if [ "${TARGETARCH}" = "arm64" ]; then \
Expand All @@ -10,7 +10,7 @@ RUN if [ "${TARGETARCH}" = "arm64" ]; then \
cp linux_linux_amd64_v1/nibid /root/nibid; \
fi

FROM alpine
FROM alpine:latest

WORKDIR /root
RUN apk --no-cache add ca-certificates
Expand Down
14 changes: 3 additions & 11 deletions contrib/make/release.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,10 @@
PACKAGE_NAME := github.com/NibiruChain/nibiru
GOLANG_CROSS_VERSION ?= v1.21.5

verify-dist-temp:
@if [ ! -d "dist-temp" ]; then \
echo "dist-temp does not exist, please run release-snapshot first"; \
exit 1; \
fi

# The `make release` command is running a Docker container with the image
# `gorelease/goreleaser-cross:${GOLANG_CROSS_VERSION}`. This command:
# `-v "$(CURDIR)":/go/src/$(PACKAGE_NAME)`: mounts the current directory
# `release --rm-dist`: executes the release inside the directory
# `release --clean`: executes the release inside the directory
release: verify-dist-temp
docker run \
--rm \
Expand All @@ -24,7 +18,7 @@ release: verify-dist-temp
-e CGO_ENABLED=1 \
-e GITHUB_TOKEN=${GITHUB_TOKEN} \
goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
release --rm-dist
release --clean

release-snapshot:
docker run \
Expand All @@ -35,6 +29,4 @@ release-snapshot:
-w /go/src/$(PACKAGE_NAME) \
-e CGO_ENABLED=1 \
goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
release --clean --snapshot
rm -rf dist-temp
cp -r dist dist-temp
release --clean --snapshot

0 comments on commit 0037fef

Please sign in to comment.