Skip to content

Commit

Permalink
feat: Add git flow to make docker image (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
gyuguen authored Jul 5, 2021
1 parent d771b7b commit ebe7145
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Docker

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
push:
branches: [ master ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v1.10.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3.3.0
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v2.6.1
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
FROM golang:1.16.5-buster AS build-env

# Install minimum necessary dependencies,
ENV PACKAGES make git gcc
RUN apt-get update -y
RUN apt-get install -y $PACKAGES

# Create directory
RUN mkdir -p /src/panacea-core /src/wasmvm

# Add 'panacea-core' source files
COPY . /src/panacea-core

# Set working directory for the 'panacea-core' build
WORKDIR /src/panacea-core

# Install panacea-core
RUN make clean && make build

# Get 'libwasmvm.so' from wasmvm
RUN git clone -b v0.14.0 https://github.com/CosmWasm/wasmvm.git /src/wasmvm

# Final image
FROM debian:buster-slim

# Copy over binaries from the build-env
COPY --from=build-env /src/panacea-core/build/panacead /usr/bin/panacead
# Copy 'libwasmvm.so' liberary from the build-env
COPY --from=build-env /src/wasmvm/api/libwasmvm.so /usr/lib/libwasmvm.so

RUN chmod +x /usr/bin/panacead

EXPOSE 26656 26657 1317 9090

0 comments on commit ebe7145

Please sign in to comment.