1
- FROM alpine:latest
1
+ FROM alpine:latest as build
2
2
3
3
LABEL description="Armadietto NodeJS web service (a RemoteStorageJS backend)"
4
4
5
+ ARG PROJECT_NAME="armadietto"
6
+ ARG PKG_MANAGER="yarn"
7
+ ARG INSTALL_COMMAND="yarn install --pure-lockfile --production"
8
+
9
+ RUN mkdir /opt/armadietto
10
+ WORKDIR /opt/armadietto
11
+
12
+ RUN apk add nodejs $PKG_MANAGER
13
+
14
+ COPY package.json ./
15
+ COPY package-lock.json ./
16
+ COPY yarn.lock ./
17
+
18
+ RUN $INSTALL_COMMAND
19
+
20
+ FROM alpine:latest
21
+
5
22
ARG CONFIG_PATH_STORAGE="/usr/share/armadietto"
6
23
ARG PROJECT_NAME="armadietto"
7
24
ARG PORT="8000"
8
25
ARG USER="armadietto"
9
- ARG PKG_MANAGER="yarn"
10
- ARG INSTALL_COMMAND="yarn global --cache-folder /dev/shm/yarn-cache add"
11
26
12
27
ENV NODE_ENV production
13
28
ENV PROJECT_NAME=$PROJECT_NAME
29
+ ENV PORT=$PORT
14
30
15
- RUN apk add nodejs $PKG_MANAGER
31
+ RUN mkdir /opt/armadietto
32
+ WORKDIR /opt/armadietto
33
+
34
+ RUN apk add nodejs
16
35
RUN mkdir -m 0700 $CONFIG_PATH_STORAGE
17
36
RUN adduser -u 6582 -HD $PROJECT_NAME
18
37
RUN chown $PROJECT_NAME $CONFIG_PATH_STORAGE
19
38
20
- RUN $INSTALL_COMMAND $PROJECT_NAME
39
+ COPY --from=build /opt/armadietto/node_modules/ node_modules/
40
+ COPY package.json ./
41
+ COPY README.md ./
42
+ COPY lib/ lib/
43
+ COPY bin/ bin/
44
+
45
+ RUN ln -s /opt/armadietto/bin/armadietto.js /usr/local/bin/armadietto
21
46
22
47
COPY docker/config.json /etc/armadietto.conf.json
23
48
@@ -27,39 +52,4 @@ USER $PROJECT_NAME
27
52
28
53
CMD $PROJECT_NAME -c /etc/armadietto.conf.json
29
54
30
- HEALTHCHECK CMD curl --fail http://127.0.0.1:$PORT/ || exit 1
31
-
32
- # ## Install ###
33
- #
34
- # BUILD:
35
- #
36
- # default for amd64 architecture
37
- #
38
- # > docker build -t armadietto:latest .
39
- # > docker build -t --build-arg PKG_MANAGER="npm" --build-arg INSTALL_COMMAND="npm i -g" armadietto:latest .
40
- #
41
- # RUN:
42
- #
43
- # > docker run --rm -p 8000:8000 rarmadietto:latest
44
- #
45
- # INFO: config.json needs to be byside the Dockerfile
46
- #
47
- # {
48
- # "allow_signup": true,
49
- # "storage_path": "/usr/share/armadietto",
50
- # "cache_views": true,
51
- # "http": {
52
- # "host": "0.0.0.0",
53
- # "port": 8000
54
- # },
55
- # "https": {
56
- # "enable": false,
57
- # "force": false,
58
- # "port": 4443,
59
- # "cert": "/etc/letsencrypt/live/example.com/cert.pem",
60
- # "key": "/etc/letsencrypt/live/example.com/privkey.pem"
61
- # },
62
- # "basePath": ""
63
- # }
64
- #
65
- # ##
55
+ HEALTHCHECK --start-period=10s CMD wget -q -O /dev/null http://127.0.0.1:$PORT/
0 commit comments