refactored Dockerfile
This commit is contained in:
parent
8f4a53db64
commit
90f6a07d4a
8 changed files with 68 additions and 33 deletions
60
Dockerfile
60
Dockerfile
|
@ -1,19 +1,59 @@
|
|||
FROM node:10 AS builder
|
||||
RUN addgroup --gid 10001 app && adduser --disabled-password --gecos '' --gid 10001 --home /app --uid 10001 app
|
||||
COPY package*.json /app/
|
||||
WORKDIR /app
|
||||
RUN npm install --production
|
||||
##
|
||||
# Firefox Send - Mozilla
|
||||
#
|
||||
# License https://github.com/mozilla/send/blob/master/LICENSE
|
||||
##
|
||||
|
||||
FROM node:10-slim
|
||||
RUN addgroup --gid 10001 app && adduser --disabled-password --gecos '' --gid 10001 --home /app --uid 10001 app
|
||||
|
||||
# Build project
|
||||
FROM node:10 AS builder
|
||||
RUN set -x \
|
||||
# Add user
|
||||
&& addgroup --gid 10001 app \
|
||||
&& adduser --disabled-password \
|
||||
--gecos '' \
|
||||
--gid 10001 \
|
||||
--home /app \
|
||||
--uid 10001 \
|
||||
app
|
||||
COPY --chown=app:app . /app
|
||||
USER app
|
||||
WORKDIR /app
|
||||
COPY --chown=app:app --from=builder /app .
|
||||
COPY --chown=app:app . .
|
||||
RUN ls -la
|
||||
RUN set -x \
|
||||
# Build
|
||||
&& npm ci \
|
||||
&& npm run build
|
||||
|
||||
|
||||
# Main image
|
||||
FROM node:10-slim
|
||||
RUN set -x \
|
||||
# Add user
|
||||
&& addgroup --gid 10001 app \
|
||||
&& adduser --disabled-password \
|
||||
--gecos '' \
|
||||
--gid 10001 \
|
||||
--home /app \
|
||||
--uid 10001 \
|
||||
app
|
||||
RUN apt-get update && apt-get -y install git-core
|
||||
USER app
|
||||
WORKDIR /app
|
||||
COPY --chown=app:app package*.json ./
|
||||
COPY --chown=app:app app app
|
||||
COPY --chown=app:app common common
|
||||
COPY --chown=app:app public/locales public/locales
|
||||
COPY --chown=app:app server server
|
||||
COPY --chown=app:app --from=builder /app/dist dist
|
||||
|
||||
RUN ls -la
|
||||
RUN npm ci --production && npm cache clean --force
|
||||
RUN mkdir -p /app/.config/configstore
|
||||
RUN ln -s dist/version.json version.json
|
||||
|
||||
ENV PORT=1443
|
||||
EXPOSE $PORT
|
||||
|
||||
EXPOSE ${PORT}
|
||||
|
||||
CMD ["node", "server/bin/prod.js"]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue