Last active
October 1, 2023 12:14
-
-
Save iexa/af8d237aa82684cdb06e764171e4be96 to your computer and use it in GitHub Desktop.
Dockerfile tips
This file contains hidden or 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
## NODE | |
################################## | |
# multi-stage build to exclude intermediate build files and keep only resulting artifacts | |
# -slim uses debian and is similar in size, alpine ~120 / -sim ~180mb, while full >1gb! | |
FROM node:16-alpine AS build | |
# FROM node:18-slim AS build | |
WORKDIR /app | |
COPY . . | |
RUN yarn install | |
# FROM gcr.io/distroless/nodejs18-debian11 | |
FROM node:16-alpine | |
COPY --from=build /app /app | |
EXPOSE 3000 | |
# react-scripts -> do not try to open browser window as it tries to use powershell even in docker | |
ENV BROWSER=none | |
# if using host/bind mounts from windows, volumes are fine | |
ENV WATCHPACK_POLLING=true | |
CMD ["yarn", "start"] | |
######################################## |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment