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

Build and Push Fuel-Core Docker Image #110

Merged
merged 33 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
cb38253
Adding gchr deploy image
rfuelsh Jan 4, 2022
69f3983
Updating gchcr workflow
rfuelsh Jan 4, 2022
1e9b127
Updating gchcr workflow
rfuelsh Jan 4, 2022
022065b
Updating gchcr workflow
rfuelsh Jan 4, 2022
6f874ac
Adding new workflow name
rfuelsh Jan 4, 2022
12f382a
Adding new workflow name
rfuelsh Jan 4, 2022
8242d03
Adding new workflow name
rfuelsh Jan 4, 2022
b52695c
Testing cache
rfuelsh Jan 4, 2022
93743ca
Testing cache
rfuelsh Jan 4, 2022
a0468d1
Updating tags
rfuelsh Jan 4, 2022
97963aa
testing caching
rfuelsh Jan 4, 2022
494ab55
testing GA caching
rfuelsh Jan 4, 2022
477236b
Remove branch extract
rfuelsh Jan 4, 2022
dc8fc44
Removing --mount ssh from RUN
rfuelsh Jan 4, 2022
c58bb79
Updating ci.yaml with ghcr.io build&push
rfuelsh Jan 5, 2022
d514bc0
Updating docker build&publish based on master only
rfuelsh Jan 5, 2022
dd63910
Gating deploy based on master
rfuelsh Jan 5, 2022
09c385c
Adding ghcr.io build&push only for master
rfuelsh Jan 5, 2022
1f86194
adding release build & publish
rfuelsh Jan 7, 2022
8af6a58
Updating build-publish job names
rfuelsh Jan 7, 2022
02f31db
Updating build-publish job names
rfuelsh Jan 7, 2022
2f882e8
testing workflow
rfuelsh Jan 7, 2022
ce6748a
reverting back to original version
rfuelsh Jan 7, 2022
c1da522
reverting back to original version
rfuelsh Jan 7, 2022
bf6a16d
Remove test tag
rfuelsh Jan 7, 2022
b2906d2
Updating docker-compose.yml
rfuelsh Jan 7, 2022
3eac5b7
Remove ssh RUN command
rfuelsh Jan 7, 2022
a17c306
Update with latest tag
rfuelsh Jan 11, 2022
6eebc11
Enabling latest tag
rfuelsh Jan 11, 2022
b4b7499
fixing latest tagging still
rfuelsh Jan 11, 2022
281593e
latest tagging completed
rfuelsh Jan 11, 2022
9406ea7
Merge branch 'master' into roy-docker-ghcr-build
rfuelsh Jan 12, 2022
812308e
Adjusting ci workflow to push to fuel-core repo
rfuelsh Jan 13, 2022
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
87 changes: 87 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
REGISTRY: ghcr.io

jobs:
build:
Expand Down Expand Up @@ -88,3 +89,89 @@ jobs:
uses: katyo/publish-crates@v1
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}

build-publish-master-image:
needs: build
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

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

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/fuellabs/fuel-core
tags: |
type=sha
type=ref,event=branch
type=ref,event=tag
flavor: |
latest=${{ github.ref == 'refs/heads/master' }}

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

- name: Log in to the ghcr.io registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push the image to ghcr.io
uses: docker/build-push-action@v2
with:
context: .
file: deployment/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

build-publish-release-image:
# Build & Publish Docker Image Per Fuel-Core Release
needs: publish
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

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

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/fuellabs/fuel-core

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

- name: Log in to the ghcr.io registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push the image to ghcr.io
uses: docker/build-push-action@v2
with:
context: .
file: deployment/Dockerfile
push: true
tags: ${{ github.ref_name }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
5 changes: 2 additions & 3 deletions deployment/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ RUN apt-get update && \
clang \
libclang-dev \
libssl-dev \
&& mkdir -p ~/.ssh && ssh-keyscan github.com >> ~/.ssh/known_hosts \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /build/

COPY . .

RUN --mount=type=ssh cargo build --release
RUN cargo build --release

# Stage 2: Run
FROM ubuntu:20.04 as run
Expand Down Expand Up @@ -47,4 +46,4 @@ COPY --from=builder /build/target/release/fuel-core.d .
# hadolint ignore=DL3025
CMD exec ./fuel-core --ip ${IP} --port ${PORT} --db-path ${DB_PATH}

EXPOSE ${PORT}
EXPOSE ${PORT}
8 changes: 5 additions & 3 deletions deployment/docker-compose.yml → docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
version: "3"
version: "3.9"

services:
api:
build: .
fuel-core:
build:
context: .
dockerfile: deployment/Dockerfile
image: fuel-core
ports:
- "4000:4000"
Expand Down