-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create a minimal docker image and github workflow for building …
…it when pushed to master branch (#60) * feat: create a minimal docker image and github workflow for building it when pushed to master branch * fix: add --platform target * feat: add static build for graphql binary * feat: added Docker section to README and a simple docker-compose.yml that starts all indexing * fix: add link to ghcr package repo * fix: remove postgres volume * fix: only build docker image for merges into master from a release * fix: Dockerfile * fix: build docker image only for merges from release/** branches to master * feat: add docker usage instructions to docs * feat: add docs for creating a new project with docker * feat: build dynamically linked binaries with debian base image
- Loading branch information
Showing
10 changed files
with
159 additions
and
5 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,3 @@ | ||
.git | ||
Dockerfile | ||
.env |
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,56 @@ | ||
name: Build & publish docker image | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- master | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
jobs: | ||
build: | ||
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Login against a Docker registry | ||
# https://github.com/docker/login-action | ||
- name: Log into registry ${{ env.REGISTRY }} | ||
uses: docker/login-action@v3 | ||
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@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
type=sha | ||
type=sha,format=long | ||
# set latest tag for default branch | ||
type=raw,value=latest,enable={{is_default_branch}} | ||
# Build and push Docker image with Buildx | ||
# https://github.com/docker/build-push-action | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
push: true | ||
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,26 @@ | ||
FROM --platform=linux/amd64 rust:1.79-slim-bookworm as builder | ||
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true | ||
RUN apt update && apt install -y libssl-dev binutils libc-dev libstdc++6 pkg-config | ||
|
||
WORKDIR /app | ||
COPY . . | ||
RUN cargo build --release | ||
RUN strip /app/target/release/rindexer_cli | ||
|
||
FROM --platform=linux/amd64 node:lts-bookworm as node-builder | ||
RUN apt update && apt install -y ca-certificates | ||
WORKDIR /app | ||
COPY . . | ||
RUN cd /app/graphql && npm i && npm run build-linux | ||
|
||
FROM --platform=linux/amd64 debian:bookworm-slim | ||
RUN apt update \ | ||
&& apt install -y libssl-dev libc-dev libstdc++6 ca-certificates lsof \ | ||
&& apt-get autoremove --yes \ | ||
&& apt-get clean --yes \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=node-builder /app/core/resources/rindexer-graphql-linux /app/resources/rindexer-graphql-linux | ||
COPY --from=builder /app/target/release/rindexer_cli /app/rindexer | ||
|
||
ENTRYPOINT ["/app/rindexer"] |
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
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,18 @@ | ||
networks: | ||
default: | ||
name: rindexer_default | ||
|
||
services: | ||
rindexer: | ||
image: ghcr.io/joshstevens19/rindexer | ||
platform: linux/amd64 | ||
command: | | ||
start -p /app/project_path all | ||
environment: | ||
- PROJECT_PATH | ||
- DATABASE_URL | ||
volumes: | ||
- ${PROJECT_PATH}:/app/project_path | ||
ports: | ||
- 3001:3001 | ||
restart: always |
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
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
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
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
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