Skip to content

Commit

Permalink
First iteration updating Docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
peterMuriuki committed Jun 7, 2024
1 parent c6b2d4f commit c392423
Showing 1 changed file with 32 additions and 31 deletions.
63 changes: 32 additions & 31 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,59 +23,60 @@ USER node
RUN yarn lerna run build


# FROM node:16.18-alpine as nodejsbuild
FROM node:16.18-alpine as nodejsbuild

# COPY --from=sources /usr/src/express-server /usr/src/express-server
COPY --from=sources /usr/src/express-server /usr/src/express-server

# WORKDIR /usr/src/express-server
# RUN yarn && yarn tsc && npm prune -production --legacy-peer-deps
WORKDIR /usr/src/express-server
RUN yarn && yarn tsc && npm prune -production --legacy-peer-deps

# # Remove unused dependencies
# RUN rm -rf ./node_modules/typescript
# Remove unused dependencies
RUN rm -rf ./node_modules/typescript

# TODO - change image to use one with python or install python here
# FROM nikolaik/python-nodejs:python3.8-nodejs18-alpine as final
FROM nikolaik/python-nodejs:python3.12-nodejs22-alpine as final

# # Use tini for NodeJS application https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#handling-kernel-signals
# RUN apk add --no-cache tini curl

# # confd
# RUN curl -sSL -o /usr/local/bin/confd https://github.com/kelseyhightower/confd/releases/download/v0.16.0/confd-0.16.0-linux-amd64 \
# && chmod +x /usr/local/bin/confd
# Use tini for NodeJS application https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md#handling-kernel-signals
RUN apk add --no-cache tini curl

# COPY ./docker/confd_env.toml /etc/confd/conf.d/appconfig.toml
# COPY ./docker/config.js.tmpl /etc/confd/templates/config.js.tmpl
# confd
RUN curl -sSL -o /usr/local/bin/confd https://github.com/kelseyhightower/confd/releases/download/v0.16.0/confd-0.16.0-linux-amd64 \
&& chmod +x /usr/local/bin/confd

# COPY ./docker/app.sh /usr/local/bin/app.sh
# RUN chmod +x /usr/local/bin/app.sh
COPY ./docker/confd_env.toml /etc/confd/conf.d/appconfig.toml
COPY ./docker/config.js.tmpl /etc/confd/templates/config.js.tmpl

# WORKDIR /usr/src/web
COPY ./docker/app.sh /usr/local/bin/app.sh
RUN chmod +x /usr/local/bin/app.sh

# COPY --from=build /project/node_modules /usr/src/web/node_modules
# COPY --from=build /project/app/build /usr/src/web
WORKDIR /usr/src/web

COPY --from=build /project/node_modules /usr/src/web/node_modules
COPY --from=build /project/app/build /usr/src/web

# # RUN chown -R node /usr/src/web

# WORKDIR /usr/src/app
# RUN chown -R pn /usr/src/web

# COPY --from=nodejsbuild /usr/src/express-server/build /usr/src/app
# COPY --from=nodejsbuild /usr/src/express-server/node_modules /usr/src/app/node_modules
WORKDIR /usr/src/app

COPY --from=nodejsbuild /usr/src/express-server/build /usr/src/app
COPY --from=nodejsbuild /usr/src/express-server/node_modules /usr/src/app/node_modules

# RUN pip install -r /usr/src/app/fhir-tooling/requirements.txt

# # RUN chown -R node /usr/src/app
RUN pip install -r /usr/src/app/fhir-tooling/requirements.txt

# # USER node
# RUN chown -R pn /usr/src/app

# ENV EXPRESS_REACT_BUILD_PATH /usr/src/web/
# USER pn

# EXPOSE 3000
ENV EXPRESS_REACT_BUILD_PATH /usr/src/web/

# CMD ["python3"]
EXPOSE 3000

ENTRYPOINT [ "/bin/sh" ]
CMD [ "/bin/sh", "-c", "/usr/local/bin/app.sh && node /usr/src/app/dist" ]

# ENTRYPOINT [ "/bin/sh" ]
# ENTRYPOINT [ "/bin/sh", "-c", "/usr/local/bin/app.sh && node ." ]

# ENTRYPOINT ["/sbin/tini", "--"]
ENTRYPOINT ["/sbin/tini", "--"]

0 comments on commit c392423

Please sign in to comment.