Dockerfile best practices
This commit is contained in:
parent
126feaacdd
commit
411d1492f4
1 changed files with 10 additions and 5 deletions
15
Dockerfile
15
Dockerfile
|
@ -6,11 +6,11 @@ FROM node:lts AS build-ui
|
|||
WORKDIR /usr/local/src/advent22_ui
|
||||
|
||||
# install dependencies
|
||||
COPY ui/package*.json ui/yarn*.lock .
|
||||
COPY ui/package*.json ui/yarn*.lock ./
|
||||
RUN yarn install --production false
|
||||
|
||||
# copy and build full ui
|
||||
COPY ui .
|
||||
COPY ui ./
|
||||
RUN yarn build --dest /tmp/advent22_ui/html
|
||||
|
||||
###########
|
||||
|
@ -23,12 +23,17 @@ WORKDIR /usr/local/src/advent22_api
|
|||
# env setup
|
||||
ENV \
|
||||
PRODUCTION_MODE="true" \
|
||||
APP_MODULE="advent22_api.app:app"
|
||||
MODULE_NAME="advent22_api.app"
|
||||
|
||||
# install api
|
||||
COPY api .
|
||||
RUN python -m pip --no-cache-dir install .
|
||||
COPY api ./
|
||||
RUN set -ex; \
|
||||
rm -rf /app; \
|
||||
\
|
||||
python -m pip --no-cache-dir install ./
|
||||
|
||||
# add prebuilt ui
|
||||
COPY --from=build-ui /tmp/advent22_ui /usr/local/share/advent22_ui
|
||||
|
||||
# run as unprivileged user
|
||||
USER nobody
|
||||
|
|
Loading…
Reference in a new issue