Skip to content

Commit

Permalink
use base image
Browse files Browse the repository at this point in the history
  • Loading branch information
NickVolynkin committed Jun 3, 2023
1 parent 8ab6703 commit 43f14d4
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 73 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.git
.idea
./.*
build
Dockerfile*
scripts/.secret
scripts/.user
venv
.idea
Dockerfile*
6 changes: 6 additions & 0 deletions .github/filters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# used by dorny/paths-filter@v2
dockerfile-base:
- 'Dockerfile.base'
# tests run on 1.10 only
- 'requirements.txt'
40 changes: 22 additions & 18 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Check and build Dockerfile
on:
push:
branches: [ master ]
# pull_request:
pull_request:

concurrency:
group: ${{
Expand All @@ -18,7 +18,7 @@ env:

jobs:
hadolint:
runs-on: [ ubuntu-22.04 ]
runs-on: [ self-hosted, aws_autoscaling ]
steps:
- uses: actions/checkout@v3

Expand All @@ -27,31 +27,35 @@ jobs:
recursive: true

build-image:
runs-on: [ ubuntu-22.04 ]
runs-on: [ self-hosted, aws_autoscaling ]

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: dorny/paths-filter@v2
id: changes
with:
filters: .github/filters.yml

- name: Log in to GitHub registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Pull ${{ env.IMAGE_NAME }}:latest as build cache
run: docker pull ${{ env.IMAGE_NAME }}:latest || true
- name: Pull ${{ env.IMAGE_NAME }}:base
run: docker pull ${{ env.IMAGE_NAME }}:base || true

- uses: actions/checkout@v3
with:
submodules: recursive
- name: Rebuild ${{ env.IMAGE_NAME }}:base
if: steps.changes.outputs.dockerfile-base == 'true'
run: docker build -t ${{ env.IMAGE_NAME }}:base --file Dockerfile.base .

- name: Push ${{ env.IMAGE_NAME }}:base to GitHub registry
if: github.ref == 'refs/heads/master' && steps.changes.outputs.dockerfile-base == 'true'
run: docker push ${{ env.IMAGE_NAME }}:base

- name: Build a Docker image
run: |
set -xe
docker build -t ${{ env.IMAGE_NAME }}:latest .
run: docker build -t ${{ env.IMAGE_NAME }}:latest .

- name: Push ${{ env.IMAGE_NAME }}:latest to GitHub registry
if: github.ref == 'refs/heads/master'
run: docker push ${{ env.IMAGE_NAME }}:latest

- name: Build proof market in a container
run: |
set -xe
docker run -t \
-v $(pwd):/proof-market-toolchain \
ghcr.io/nilfoundation/proof-market-toolchain:latest sh ./build.sh
49 changes: 10 additions & 39 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,44 +1,15 @@
# syntax=docker/dockerfile:1

FROM ubuntu:22.04
RUN DEBIAN_FRONTEND=noninteractive \
set -xe \
&& apt-get update \
&& apt-get -y --no-install-recommends --no-install-suggests install \
autoconf \
automake \
build-essential \
clang-12 \
cmake \
git \
gnutls-dev \
libc-ares-dev \
libfmt-dev \
libhwloc-dev \
liblz4-dev \
libprotobuf-dev \
libsctp-dev \
libssl-dev \
libyaml-cpp-dev \
pkg-config \
ragel \
systemtap-sdt-dev \
wget \
xfslibs-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
FROM ghcr.io/nilfoundation/proof-market-toolchain:base

WORKDIR /tmp
RUN set -xe \
&& wget -q --no-check-certificate \
https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz \
&& tar -xvf boost_1_76_0.tar.gz \
&& rm boost_1_76_0.tar.gz
WORKDIR /proof-market-toolchain

WORKDIR /tmp/boost_1_76_0
RUN set -xe \
&& sh ./bootstrap.sh \
&& ./b2 \
&& ./b2 install
COPY . /proof-market-toolchain

WORKDIR /proof-market-toolchain
RUN ./build.sh

#FROM ghcr.io/nilfoundation/proof-market-toolchain:base
#
#COPY scripts /proof-market-toolchain
#COPY --from=builder /proof-market-toolchain/build/bin/ /proof-market-toolchain
#WORKDIR /proof-market-toolchain
44 changes: 44 additions & 0 deletions Dockerfile.base
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# syntax=docker/dockerfile:1

FROM ubuntu:22.04
RUN DEBIAN_FRONTEND=noninteractive \
set -xe \
&& apt-get update \
&& apt-get -y --no-install-recommends --no-install-suggests install \
autoconf \
automake \
build-essential \
clang-12 \
cmake \
git \
gnutls-dev \
libc-ares-dev \
libfmt-dev \
libhwloc-dev \
liblz4-dev \
libprotobuf-dev \
libsctp-dev \
libssl-dev \
libyaml-cpp-dev \
pkg-config \
ragel \
systemtap-sdt-dev \
wget \
xfslibs-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /tmp
RUN set -xe \
&& wget -q --no-check-certificate \
https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz \
&& tar -xvf boost_1_76_0.tar.gz \
&& rm boost_1_76_0.tar.gz

WORKDIR /tmp/boost_1_76_0
RUN set -xe \
&& sh ./bootstrap.sh \
&& ./b2 \
&& ./b2 install

WORKDIR /proof-market-toolchain
14 changes: 0 additions & 14 deletions Dockerfile.toolchain

This file was deleted.

0 comments on commit 43f14d4

Please sign in to comment.