mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 00:03:07 +00:00
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
|
WORKDIR /usr/local/src/advent22_ui
|
||||||
|
|
||||||
# install dependencies
|
# install dependencies
|
||||||
COPY ui/package*.json ui/yarn*.lock .
|
COPY ui/package*.json ui/yarn*.lock ./
|
||||||
RUN yarn install --production false
|
RUN yarn install --production false
|
||||||
|
|
||||||
# copy and build full ui
|
# copy and build full ui
|
||||||
COPY ui .
|
COPY ui ./
|
||||||
RUN yarn build --dest /tmp/advent22_ui/html
|
RUN yarn build --dest /tmp/advent22_ui/html
|
||||||
|
|
||||||
###########
|
###########
|
||||||
|
@ -23,12 +23,17 @@ WORKDIR /usr/local/src/advent22_api
|
||||||
# env setup
|
# env setup
|
||||||
ENV \
|
ENV \
|
||||||
PRODUCTION_MODE="true" \
|
PRODUCTION_MODE="true" \
|
||||||
APP_MODULE="advent22_api.app:app"
|
MODULE_NAME="advent22_api.app"
|
||||||
|
|
||||||
# install api
|
# install api
|
||||||
COPY api .
|
COPY api ./
|
||||||
RUN python -m pip --no-cache-dir install .
|
RUN set -ex; \
|
||||||
|
rm -rf /app; \
|
||||||
|
\
|
||||||
|
python -m pip --no-cache-dir install ./
|
||||||
|
|
||||||
# add prebuilt ui
|
# add prebuilt ui
|
||||||
COPY --from=build-ui /tmp/advent22_ui /usr/local/share/advent22_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