Skip to content

Commit

Permalink
feat: build specific version of the binary (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
vgalaktionov authored Feb 13, 2024
1 parent 4387f15 commit 3909674
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/on-push-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -31,6 +31,11 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Read VERSION file
id: version
run: |
echo "version=$(cat VERSION | awk '{$1=$1};1')" >> $GITHUB_OUTPUT
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
Expand All @@ -42,6 +47,7 @@ jobs:
type=ref,event=tag
type=ref,event=pr
type=sha,format=long,prefix=
type=raw,value=${{ steps.version.outputs.version }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
Expand Down
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
FROM debian:bookworm-slim
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
ca-certificates \
curl \
# unzip \
ca-certificates \
curl \
# unzip \
&& rm -rf /var/lib/apt/lists/*

ARG TARGETARCH

COPY VERSION /VERSION

COPY download-binary.sh /download-binary.sh

RUN chmod +x /download-binary.sh && /download-binary.sh
Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.1.4
8 changes: 6 additions & 2 deletions download-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@
# Determine the architecture from the TARGETARCH environment variable
ARCH=$TARGETARCH

# Read the version from the VERSION file, trim the leading and trailing whitespace
VERSION=$(cat ./VERSION | awk '{$1=$1};1')
echo "Building for binary version $VERSION"

# Set the download URL based on the architecture
if [ "$ARCH" = "amd64" ]; then
URL="https://oso-local-development-binary.s3.amazonaws.com/oso-local-development-binary-linux-x86_64.tar.gz"
URL="https://oso-local-development-binary.s3.amazonaws.com/$VERSION/oso-local-development-binary-linux-x86_64.tar.gz"
elif [ "$ARCH" = "arm64" ]; then
URL="https://oso-local-development-binary.s3.amazonaws.com/dev/oso-local-development-binary-linux-arm64.tar.gz"
URL="https://oso-local-development-binary.s3.amazonaws.com/$VERSION/oso-local-development-binary-linux-arm64.tar.gz"
else
echo "Unsupported architecture: $ARCH"
exit 1
Expand Down

0 comments on commit 3909674

Please sign in to comment.