-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add git flow to make docker image (#157)
- Loading branch information
Showing
2 changed files
with
92 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |