mirror of
https://gitlab.com/timvisee/send.git
synced 2024-11-08 12:12:37 +01:00
refactored Dockerfile
This commit is contained in:
parent
8f4a53db64
commit
90f6a07d4a
@ -1,10 +1,8 @@
|
||||
node_modules
|
||||
.git
|
||||
.tox
|
||||
.DS_Store
|
||||
firefox
|
||||
assets
|
||||
docs
|
||||
test
|
||||
coverage
|
||||
.circleci
|
||||
.nyc_output
|
||||
.vscode
|
||||
.DS_Store
|
||||
coverage
|
||||
docs
|
||||
firefox
|
||||
node_modules
|
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"]
|
||||
|
@ -1,8 +1,8 @@
|
||||
# Custom Loaders
|
||||
|
||||
## Generate Asset Map
|
||||
## Android Index Plugin
|
||||
|
||||
This loader enumerates all the files in `assets/` so that `common/assets.js` can provide mappings from the source filename to the hashed filename used on the site.
|
||||
Generates the `index.html` page for the native android client
|
||||
|
||||
## Version Plugin
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const genmap = require('../build/generate_asset_map');
|
||||
const genmap = require('./generate_asset_map');
|
||||
const isServer = typeof genmap === 'function';
|
||||
let prefix = '';
|
||||
let manifest = {};
|
||||
|
@ -1,3 +1,7 @@
|
||||
# Common Code
|
||||
|
||||
This directory contains code loaded by both the frontend `app` and backend `server`. The code here can be challenging to understand at first because the contexts for the two (three counting the dev server) environments that include them are quite different, but the purpose of these modules are quite simple, to provide mappings from the source assets (`copy-16.png`) to the concrete production assets (`copy-16.db66e0bf.svg`).
|
||||
|
||||
## Generate Asset Map
|
||||
|
||||
This loader enumerates all the files in `assets/` so that `common/assets.js` can provide mappings from the source filename to the hashed filename used on the site.
|
@ -1,13 +1,6 @@
|
||||
## Setup
|
||||
|
||||
Before building the Docker image, you must build the production assets:
|
||||
|
||||
```sh
|
||||
npm run build
|
||||
```
|
||||
|
||||
Then you can run either `docker build` or `docker-compose up`.
|
||||
|
||||
Run `docker build -t send:latest .` to create an image or `docker-compose up` to run a full testable stack. *We don't recommend using docker-compose for production.*
|
||||
|
||||
## Environment variables:
|
||||
|
||||
|
@ -67,7 +67,7 @@ const serviceWorker = {
|
||||
},
|
||||
{
|
||||
// loads all assets from assets/ for use by common/assets.js
|
||||
test: require.resolve('./build/generate_asset_map.js'),
|
||||
test: require.resolve('./common/generate_asset_map.js'),
|
||||
use: ['babel-loader', 'val-loader']
|
||||
}
|
||||
]
|
||||
@ -176,7 +176,7 @@ const web = {
|
||||
},
|
||||
{
|
||||
// loads all assets from assets/ for use by common/assets.js
|
||||
test: require.resolve('./build/generate_asset_map.js'),
|
||||
test: require.resolve('./common/generate_asset_map.js'),
|
||||
use: ['babel-loader', 'val-loader']
|
||||
}
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user