Skip to content

Commit

Permalink
use alpine as the final base image
Browse files Browse the repository at this point in the history
  • Loading branch information
HJ-Fan committed Jul 31, 2024
1 parent d13225f commit 7cf6353
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 74 deletions.
17 changes: 12 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ RUN docker-entrypoint.sh generate -i ${BASEPATH}/${OPENAPI_REDFISH_YAML} -g go-s
RUN docker-entrypoint.sh generate -i ${BASEPATH}/${OPENAPI_YAML} -g typescript-axios -o ${BASEPATH}/webui/src/axios --skip-validate-spec


FROM golang:1.22.1 AS go
FROM golang:1.22.1-alpine AS go
ENV BASEPATH=/cfm

RUN apk add git make
# copy source code with generated files to go image
COPY --from=api-gen ${BASEPATH} ${BASEPATH}

Expand All @@ -46,23 +47,29 @@ RUN git apply api/patch/fix-missing-import.patch
# build the excutable
RUN make build-go

FROM node:slim as npm
FROM node:alpine as npm
ENV BASEPATH=/cfm

# copy source code with generated files to go image
COPY --from=go ${BASEPATH}/cfm-service ${BASEPATH}/cfm-service
COPY --from=go ${BASEPATH}/cfm-cli ${BASEPATH}/cfm-cli
COPY --from=go ${BASEPATH}/webui ${BASEPATH}/webui

# setup web UI and build the dist package
WORKDIR ${BASEPATH}/webui
RUN npm install
RUN npm run build

FROM alpine:latest
ENV BASEPATH=/cfm

# copy source code with generated files to go image
COPY --from=go ${BASEPATH}/cfm-service ${BASEPATH}/cfm-service
COPY --from=go ${BASEPATH}/cfm-cli ${BASEPATH}/cfm-cli
COPY --from=npm ${BASEPATH}/webui/dist ${BASEPATH}/webui/dist

RUN ln -s /local/cfmdatastore.json ${BASEPATH}/cfmdatastore.json

LABEL org.opencontainers.image.source https://github.com/seagate/cfm

WORKDIR ${BASEPATH}
# Start the service
ENTRYPOINT [ "/cfm/cfm-service" ]
ENTRYPOINT [ "/cfm/cfm-service" ]
69 changes: 0 additions & 69 deletions docker/Dockerfile-Alpine

This file was deleted.

0 comments on commit 7cf6353

Please sign in to comment.