Skip to content

Commit

Permalink
update Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
anhductn2001 committed Mar 20, 2024
1 parent fcf9bed commit 75c7adb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build_and_push_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
push:
branches:
- main
pull_request:

permissions:
contents: read
Expand Down
33 changes: 26 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
FROM golang:1.21-alpine3.18 as go-builder

# Use Ubuntu as the base image
FROM ubuntu:latest as go-builder

# Install necessary dependencies
RUN apt-get update && apt-get install -y \
wget make \
&& rm -rf /var/lib/apt/lists/*

# Download and install Go 1.21
RUN wget https://golang.org/dl/go1.21.4.linux-amd64.tar.gz && \
tar -xvf go1.21.4.linux-amd64.tar.gz && \
mv go /usr/local && \
rm go1.21.4.linux-amd64.tar.gz

# Set Go environment variables
ENV GOROOT=/usr/local/go
ENV GOPATH=$HOME/go
ENV PATH=$GOPATH/bin:$GOROOT/bin:$PATH

# Set the working directory
WORKDIR /app

COPY go.mod go.sum* ./

ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3

RUN apk add --no-cache $PACKAGES
# Download go dependencies
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
go mod download

# Cosmwasm - Download correct libwasmvm version
RUN ARCH=$(uname -m) && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | sed 's/.* //') && \
Expand All @@ -16,6 +34,7 @@ RUN ARCH=$(uname -m) && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm |
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \
sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$ARCH | cut -d ' ' -f 1)

# Copy the remaining files
COPY . .

RUN make build
Expand Down

0 comments on commit 75c7adb

Please sign in to comment.