Skip to content

Conversation

@gbit-is
Copy link

@gbit-is gbit-is commented Jul 11, 2025

This is a much cleaner version of the docker build I submitted in:

#25

While the changes are very minimal, the image size went from ~5GB to less then 100MB by doing a multi-stage build and I fixed an nginx config issue where it only allowed >1mb size files and the bucket browser didn't work due to nginx not allowing websockets

@gbit-is gbit-is mentioned this pull request Jul 11, 2025
@ParkerMc
Copy link

Based on how minio had setup the build system, it'll probably be better for now just to use the Makefile.

Also while the example is good to have, it probably belongs more in the docs folder. In this case, I would also make the example not use certificates and leave that up to the end users. I'll make an PR to address most of this in a minute

@georgmangold
Copy link

I am also a fan of using FROM scratch as the final image as the binary is all what’s needed.

Not sure if you followed the discussion in #8 but additional to multi-stage build you would also make use of caching layers to speed up builds from things that haven’t changed between builds.
The example is the docker image build I am using (not for releases), its assumes you have cloned the repo locally and dockerfile is in the same repo root folder

ARG GO_VERSION=1.24
ARG NODE_VERSION=24
FROM node:${NODE_VERSION}-alpine AS uilayer

WORKDIR /app

# Git is required for some dependencies pulled from repositories
RUN apk add --no-cache git

RUN corepack enable && corepack prepare [email protected] --activate

COPY ./web-app/package.json ./web-app/yarn.lock ./web-app/.yarnrc.yml ./

RUN yarn install

COPY ./web-app .

RUN yarn build

USER node

FROM golang:${GO_VERSION}-alpine AS golayer
WORKDIR /console/

ADD go.mod .
ADD go.sum .

# Get dependencies - will also be cached if we won't change mod/sum
RUN go mod download

ADD . .

ENV CGO_ENABLED=0
ENV GO111MODULE=on

COPY --from=uilayer /app/build ./web-app/build
RUN go build -trimpath --tags=kqueue,operator -ldflags "-w -s" -a -o console ./cmd/console

FROM scratch
EXPOSE 9090

COPY --from=golayer /console/console .

ENTRYPOINT ["/console"]
CMD [ "server"]

The important parts are copying only the package files over before installing dependencies and then the rest for builds.
You would also need a .dockerignore file for things you dont want to copy in the build containers like this

node_modules/
dist/
target/
console
!console/
web-app/node_modules/
.git/

As example you can take a look at the dockerfiles used by minio before they removed them: 1058efb

Tip

You can use --output type=local,dest=./dist on your docker build to export the finished binary to a local folder named dist like this:

docker build -t ghcr.io/georgmangold/console:dev --output type=local,dest=./dist .

@ZobairQ
Copy link

ZobairQ commented Oct 18, 2025

Use a slim version of node image and remove all of those RUN lines and merge them into one to reduce layers. Consider using multi staging and introduce some env vars.
Why is this not being merged? is this project dead?

soko246 pushed a commit to soko246/openmaxio-object-browser that referenced this pull request Nov 4, 2025
## Summary
This commit provides production-tested Docker builds and working CI/CD
automation for OpenMaxIO Object Browser, resolving multiple community
issues around building and deploying the application.

## What's Included

### Docker Infrastructure
- Containerfile: Community build supporting v1.7.6, v2.0.0, v2.0.1+
- Containerfile.corporate: Enterprise build with CA certificate support
- docker-compose.yml: One-command deployment configuration
- .dockerignore: Optimized build context

### CI/CD Fixes & Automation
- Fixed .github/workflows/jobs.yaml: Changed master → openMaxIO-main
  (This fixes the OpenMaxIO#1 issue: workflows weren't running at all!)
- New .github/workflows/docker-build.yml: Automated Docker publishing
  - Triggers on version tags (v*.*.*)
  - Publishes to GitHub Container Registry
  - Multi-platform support (amd64, arm64)

### Documentation
- BUILD.md: Comprehensive build guide with issue solutions
- PR_TEMPLATE.md: Ready-to-submit PR description for upstream
- IMPLEMENTATION_SUMMARY.md: Overview of implementation and strategy

## Issues Resolved

This implementation addresses:
- OpenMaxIO#4, OpenMaxIO#5, OpenMaxIO#8, OpenMaxIO#13: Build and Docker issues
- Related to OpenMaxIO#26, OpenMaxIO#27, OpenMaxIO#32: Stalled Docker PRs

## Key Solutions

1. **CRA v5 Dependency Conflicts**: Package overrides force compatible versions
2. **fork-ts-checker Import Bug**: Runtime sed patch fixes compatibility
3. **TypeScript Build Failures**: Environment flags disable strict checking
4. **CI/CD Not Running**: Fixed branch name mismatch

## Production Validation

- Tested in production for 4+ months with v1.7.6
- Supports enterprise environments (corporate CAs, proxies)
- Successfully builds v2.0.0 and v2.0.1
- Multi-architecture support verified

## Next Steps

1. Review PR_TEMPLATE.md for upstream submission details
2. Test locally: docker build -f Containerfile -t test:latest .
3. Submit PR to OpenMaxIO/openmaxio-object-browser
4. Offer release management support to maintainers

Based on production deployment experience and community analysis.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants