send/Dockerfile

61 lines
1.2 KiB
Text
Raw Normal View History

2019-09-07 03:00:00 +00:00
##
# Firefox Send - Mozilla
#
# License https://github.com/mozilla/send/blob/master/LICENSE
##
# Build project
2019-01-07 20:50:01 +00:00
FROM node:10 AS builder
2019-09-07 03:00:00 +00:00
RUN set -x \
# Add user
&& addgroup --gid 10001 app \
&& adduser --disabled-password \
--gecos '' \
--gid 10001 \
--home /app \
--uid 10001 \
app
RUN npm i -g npm
2019-09-07 03:00:00 +00:00
COPY --chown=app:app . /app
USER app
2019-01-07 20:50:01 +00:00
WORKDIR /app
2019-09-07 03:00:00 +00:00
RUN set -x \
# Build
&& npm ci \
&& npm run build
2017-06-08 23:11:17 +00:00
2019-09-07 03:00:00 +00:00
# Main image
2019-01-07 20:50:01 +00:00
FROM node:10-slim
2019-09-07 03:00:00 +00:00
RUN set -x \
# Add user
&& addgroup --gid 10001 app \
&& adduser --disabled-password \
--gecos '' \
--gid 10001 \
--home /app \
--uid 10001 \
app
2019-11-06 04:19:07 +00:00
RUN apt-get update && apt-get -y install \
git-core \
&& rm -rf /var/lib/apt/lists/*
USER app
2017-06-08 23:11:17 +00:00
WORKDIR /app
2019-09-07 03:00:00 +00:00
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 npm ci --production && npm cache clean --force
RUN mkdir -p /app/.config/configstore
2019-06-03 19:25:09 +00:00
RUN ln -s dist/version.json version.json
2017-06-08 23:11:17 +00:00
ENV PORT=1443
2019-09-07 03:00:00 +00:00
EXPOSE ${PORT}
2019-01-07 20:50:01 +00:00
CMD ["node", "server/bin/prod.js"]