Skip to content
Open
Changes from all commits
Commits
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
39 changes: 38 additions & 1 deletion build/dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,42 @@
# Dockerfile defines che-machine-exec production image eclipse/che-machine-exec-dev
#

#########################################################################
############################# BUILD: ubi8-machine-exec ##################
#########################################################################

FROM registry.access.redhat.com/ubi8/go-toolset:1782923914 AS ubi8-machineexec-builder
ENV GOPATH=/go/
ENV CGO_ENABLED=1
USER root

WORKDIR /che-machine-exec/
COPY . .

RUN GOOS=linux go build -mod=vendor -ldflags '-w -s' -a -installsuffix cgo -o che-machine-exec . \
&& mkdir -p /rootfs/go/bin \
&& cp -rf /che-machine-exec/che-machine-exec /rootfs/go/bin

#########################################################################
############################# BUILD: ubi9-machine-exec ##################
#########################################################################

FROM registry.access.redhat.com/ubi9/go-toolset:9.8-1783442369 AS ubi9-machineexec-builder
ENV GOPATH=/go/
ENV CGO_ENABLED=1
USER root

WORKDIR /che-machine-exec/
COPY . .

RUN GOOS=linux go build -mod=vendor -ldflags '-w -s' -a -installsuffix cgo -o che-machine-exec . \
&& mkdir -p /rootfs/go/bin \
&& cp -rf /che-machine-exec/che-machine-exec /rootfs/go/bin

#########################################################################
############################# BUILD: alpine-machine-exec ################
#########################################################################
FROM docker.io/golang:1.25.7-alpine as go_builder

Check warning on line 50 in build/dockerfiles/Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

ENV USER=machine-exec
ENV UID=12345
Expand Down Expand Up @@ -44,10 +79,10 @@
ENV CGO_ENABLED=1
RUN GOOS=linux go build -mod=vendor -a -ldflags '-w -s' -a -installsuffix cgo -o /go/bin/che-machine-exec .

FROM docker.io/node:22-alpine as cloud_shell_builder

Check warning on line 82 in build/dockerfiles/Dockerfile

View workflow job for this annotation

GitHub Actions / build

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/
RUN corepack enable && corepack prepare yarn@4.0.0 --activate
COPY --from=go_builder /che-machine-exec/cloud-shell cloud-shell-src
WORKDIR cloud-shell-src

Check warning on line 85 in build/dockerfiles/Dockerfile

View workflow job for this annotation

GitHub Actions / build

Relative workdir without an absolute workdir declared within the build can have unexpected results if the base image changes

WorkdirRelativePath: Relative workdir "cloud-shell-src" can have unexpected results if the base image changes More info: https://docs.docker.com/go/dockerfile/rule/workdir-relative-path/
RUN yarn install --immutable && \
yarn run build && \
mkdir /app && \
Expand All @@ -59,6 +94,8 @@
COPY --from=go_builder /etc/group /etc/group
USER machine-exec

COPY --from=go_builder /go/bin/che-machine-exec /go/bin/che-machine-exec
COPY --from=ubi8-machineexec-builder --chown=0:0 /rootfs/go/bin/che-machine-exec /go/ubi8/bin/che-machine-exec
COPY --from=ubi9-machineexec-builder --chown=0:0 /rootfs/go/bin/che-machine-exec /go/ubi9/bin/che-machine-exec
COPY --from=go_builder --chown=0:0 /go/bin/che-machine-exec /go/bin/che-machine-exec
COPY --from=cloud_shell_builder /app /cloud-shell
ENTRYPOINT ["/go/bin/che-machine-exec", "--static", "/cloud-shell"]
Loading