Skip to content

Commit ace0a83

Browse files
committed
Modify Dockerfile with suggested changes
1 parent 61c8f37 commit ace0a83

File tree

1 file changed

+56
-18
lines changed

1 file changed

+56
-18
lines changed

docker/Dockerfile

Lines changed: 56 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,65 @@
1-
FROM node:lts-alpine
1+
FROM alpine:latest
22

3-
ENV NODE_ENV production
3+
LABEL description="Armadietto NodeJS web service (a RemoteStorageJS backend)"
44

5-
RUN mkdir /opt/armadietto
6-
RUN mkdir -m 0700 /usr/share/armadietto
7-
RUN adduser -u 6582 -HD armadietto
8-
RUN chown armadietto /usr/share/armadietto
5+
ARG CONFIG_PATH_STORAGE="/usr/share/armadietto"
6+
ARG PROJECT_NAME="armadietto"
7+
ARG PORT="8000"
8+
ARG USER="armadietto"
9+
ARG PKG_MANAGER="yarn"
10+
ARG INSTALL_COMMAND="yarn global --cache-folder /dev/shm/yarn-cache add"
911

10-
WORKDIR /opt/armadietto
12+
ENV NODE_ENV production
13+
ENV PROJECT_NAME=$PROJECT_NAME
1114

12-
COPY package.json ./
13-
COPY package-lock.json ./
15+
RUN apk add nodejs $PKG_MANAGER
16+
RUN mkdir -m 0700 $CONFIG_PATH_STORAGE
17+
RUN adduser -u 6582 -HD $PROJECT_NAME
18+
RUN chown $PROJECT_NAME $CONFIG_PATH_STORAGE
1419

15-
RUN npm i --production
20+
RUN $INSTALL_COMMAND $PROJECT_NAME
1621

17-
COPY README.md ./
18-
COPY bin/ bin/
19-
COPY lib/ lib/
2022
COPY docker/config.json /etc/armadietto.conf.json
21-
RUN ln -s /opt/armadietto/bin/armadietto.js /usr/local/bin/armadietto
2223

23-
VOLUME [ "/usr/share/armadietto" ]
24-
EXPOSE 8000
25-
USER armadietto
24+
VOLUME $CONFIG_PATH_STORAGE
25+
EXPOSE $PORT
26+
USER $PROJECT_NAME
27+
28+
CMD $PROJECT_NAME -c /etc/armadietto.conf.json
29+
30+
HEALTHCHECK CMD curl --fail http://127.0.0.1:$PORT/ || exit 1
2631

27-
CMD [ "armadietto", "-c", "/etc/armadietto.conf.json" ]
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+
###

0 commit comments

Comments
 (0)