Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: change base docker image to bullseye debian image instaed of alpine #145

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3485b0b
change base docker image to bullseye debian image instaed of alpine
Anmol1696 Dec 26, 2023
58f6f73
remove build-base
Anmol1696 Dec 26, 2023
59c8b50
try to fix the issue
Anmol1696 Dec 26, 2023
174e0cf
add gcc and other building essentials for docker
Anmol1696 Dec 26, 2023
8a29d41
remove linux-headers
Anmol1696 Dec 26, 2023
477c242
remove openssl as well
Anmol1696 Dec 26, 2023
424d4d3
add better dependencies
Anmol1696 Dec 26, 2023
55b0cd5
not statically linking the libraries
Anmol1696 Dec 26, 2023
5fe5314
fix typo
Anmol1696 Dec 26, 2023
82064cc
retry
Anmol1696 Dec 26, 2023
8eb9a89
change bullseye to buster
Anmol1696 Dec 26, 2023
11be9c6
change debian tag to bookworm
Anmol1696 Dec 26, 2023
f16dfdd
remove muslc-dev dep
Anmol1696 Dec 26, 2023
7f5d18b
Add file in apt-get install
Anmol1696 Dec 27, 2023
7c07d9d
move docker file to outside
Anmol1696 Dec 27, 2023
2ba8c20
update git checkout version
Anmol1696 Dec 27, 2023
0b9ba17
update glibc-static installation process
Anmol1696 Dec 27, 2023
1724433
use apt instead of apt-get install
Anmol1696 Dec 27, 2023
85d25ad
try to supress error from ld connect error
Anmol1696 Dec 27, 2023
9b7df8d
set env vars
Anmol1696 Dec 27, 2023
b5da1ef
only build for linux/amd64
Anmol1696 Dec 27, 2023
ae33b17
run go env before build
Anmol1696 Dec 27, 2023
e02381a
depricate to go1.20 and use alpine again
Anmol1696 Dec 27, 2023
c6e782e
add branch ref to docker push
Anmol1696 Dec 27, 2023
b92114c
fix docker
Anmol1696 Dec 27, 2023
97df580
create debian non static docker-image
Anmol1696 Dec 27, 2023
97ec31a
fix name clash
Anmol1696 Dec 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/docker-debian.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Docker

on:
push:
branches:
- main
- anmol/docker-debian
tags:
- "v*.*.*"
pull_request:
branches:
- main
workflow_dispatch:
inputs:
tags:
description: "Tags to build and push"
required: true
type: string

permissions:
contents: read
packages: write

jobs:
build-push:
runs-on: ubuntu-latest

env:
DOCKER_REGISTRY: ghcr.io
DOCKER_IMAGE: osmosis-labs/meshd-debian

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
check-latest: true

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}
tags: |
type=ref,event=branch
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern={{version}},value=v${{ inputs.tags }},enable=${{ inputs.tags != '' }}
flavor: |
latest=false

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

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

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Run go vendor
run: |
cd demo/ && go mod vendor

- name: Publish to GitHub Packages
uses: docker/build-push-action@v4
with:
platforms: linux/amd64 #,linux/arm64 (removing for debugging)
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
file: Dockerfile.debian
9 changes: 4 additions & 5 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- anmol/docker-debian
tags:
- "v*.*.*"
pull_request:
Expand All @@ -30,9 +31,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
Expand All @@ -46,6 +45,7 @@ jobs:
with:
images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}
tags: |
type=ref,event=branch
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern={{version}},value=v${{ inputs.tags }},enable=${{ inputs.tags != '' }}
Expand All @@ -72,7 +72,6 @@ jobs:
- name: Publish to GitHub Packages
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
platforms: linux/amd64 #,linux/arm64 (removing for debugging)
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
context: demo/
16 changes: 8 additions & 8 deletions demo/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM golang:1.21-alpine AS go-builder
FROM golang:1.20-alpine3.17 AS go-builder

RUN apk add --no-cache ca-certificates build-base git
RUN set -eux; apk add --no-cache ca-certificates build-base git wget;

WORKDIR /code

# Download dependencies and CosmWasm libwasmvm if found.
ADD go.mod go.sum ./
ADD demo/go.mod demo/go.sum ./

#ADD https://github.com/CosmWasm/wasmvm/releases/download/v$wasmvm/libwasmvm_muslc.$arch.a /lib/libwasmvm_muslc.$arch.a
## Download
Expand All @@ -20,15 +20,15 @@ COPY . /code
# force it to use static lib (from above) not standard libgo_cosmwasm.so file
# then log output of file /code/bin/meshd
# then ensure static linking
RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build-vendored \
&& file /code/build/meshd \
RUN cd demo/ && LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build \
&& file /code/demo/build/meshd \
&& echo "Ensuring binary is statically linked ..." \
&& (file /code/build/meshd | grep "statically linked")
&& (file /code/demo/build/meshd | grep "statically linked")

# --------------------------------------------------------
FROM alpine:3.16
FROM alpine:3.17

COPY --from=go-builder /code/build/meshd /usr/bin/meshd
COPY --from=go-builder /code/demo/build/meshd /usr/bin/meshd

# Install dependencies used for Starship
RUN apk add --no-cache curl make bash jq sed
Expand Down
24 changes: 24 additions & 0 deletions Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM golang:1.21-bookworm AS go-builder

RUN apt-get update && \
apt-get install -y ca-certificates wget make git file libc6-dev clang gcc build-essential

WORKDIR /code

# Download dependencies and CosmWasm libwasmvm if found.
ADD demo/go.mod demo/go.sum ./

#ADD https://github.com/CosmWasm/wasmvm/releases/download/v$wasmvm/libwasmvm_muslc.$arch.a /lib/libwasmvm_muslc.$arch.a
## Download
RUN set -eux; \
WASM_VERSION=v$(go list -m github.com/CosmWasm/wasmvm | cut -d" " -f2 | cut -d"v" -f2); \
echo $WASM_VERSION; \
wget -O /lib/libwasmvm_muslc.a https://github.com/CosmWasm/wasmvm/releases/download/${WASM_VERSION}/libwasmvm_muslc.$(uname -m).a

# Copy over code
COPY . /code

# force it to use static lib (from above) not standard libgo_cosmwasm.so file
# then log output of file /code/bin/meshd
# then ensure static linking
RUN cd demo/ && LEDGER_ENABLED=false BUILD_TAGS=muslc make build
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ build-linux-static:
$(MAKE) -C demo build-linux-static
$(MAKE) -C tests/e2e build-linux

########################################
### Docker

DOCKER_REPO := anmol1696
DOCKER_IMAGE := meshd
DOCKER_TAG := latest

docker-build:
docker buildx build --platform linux/arm64 -f Dockerfile . -t $(DOCKER_REPO)/$(DOCKER_IMAGE):$(DOCKER_TAG) --no-cache

docker-build-push:
docker buildx build --platform linux/arm64 -f Dockerfile . -t $(DOCKER_REPO)/$(DOCKER_IMAGE):$(DOCKER_TAG) --no-cache --push


########################################
### Testing

Expand Down
2 changes: 1 addition & 1 deletion demo/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/osmosis-labs/mesh-security-sdk/demo

go 1.21
go 1.20

require (
github.com/CosmWasm/wasmd v0.45.0
Expand Down
Loading
Loading