-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modify Dockerfile with suggested changes
- Loading branch information
Showing
1 changed file
with
56 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,65 @@ | ||
FROM node:lts-alpine | ||
FROM alpine:latest | ||
|
||
ENV NODE_ENV production | ||
LABEL description="Armadietto NodeJS web service (a RemoteStorageJS backend)" | ||
|
||
RUN mkdir /opt/armadietto | ||
RUN mkdir -m 0700 /usr/share/armadietto | ||
RUN adduser -u 6582 -HD armadietto | ||
RUN chown armadietto /usr/share/armadietto | ||
ARG CONFIG_PATH_STORAGE="/usr/share/armadietto" | ||
ARG PROJECT_NAME="armadietto" | ||
ARG PORT="8000" | ||
ARG USER="armadietto" | ||
ARG PKG_MANAGER="yarn" | ||
ARG INSTALL_COMMAND="yarn global --cache-folder /dev/shm/yarn-cache add" | ||
|
||
WORKDIR /opt/armadietto | ||
ENV NODE_ENV production | ||
ENV PROJECT_NAME=$PROJECT_NAME | ||
|
||
COPY package.json ./ | ||
COPY package-lock.json ./ | ||
RUN apk add nodejs $PKG_MANAGER | ||
RUN mkdir -m 0700 $CONFIG_PATH_STORAGE | ||
RUN adduser -u 6582 -HD $PROJECT_NAME | ||
RUN chown $PROJECT_NAME $CONFIG_PATH_STORAGE | ||
|
||
RUN npm i --production | ||
RUN $INSTALL_COMMAND $PROJECT_NAME | ||
|
||
COPY README.md ./ | ||
COPY bin/ bin/ | ||
COPY lib/ lib/ | ||
COPY docker/config.json /etc/armadietto.conf.json | ||
RUN ln -s /opt/armadietto/bin/armadietto.js /usr/local/bin/armadietto | ||
|
||
VOLUME [ "/usr/share/armadietto" ] | ||
EXPOSE 8000 | ||
USER armadietto | ||
VOLUME $CONFIG_PATH_STORAGE | ||
EXPOSE $PORT | ||
USER $PROJECT_NAME | ||
|
||
CMD $PROJECT_NAME -c /etc/armadietto.conf.json | ||
|
||
HEALTHCHECK CMD curl --fail http://127.0.0.1:$PORT/ || exit 1 | ||
|
||
CMD [ "armadietto", "-c", "/etc/armadietto.conf.json" ] | ||
### Install ### | ||
# | ||
# BUILD: | ||
# | ||
# default for amd64 architecture | ||
# | ||
# > docker build -t armadietto:latest . | ||
# > docker build -t --build-arg PKG_MANAGER="npm" --build-arg INSTALL_COMMAND="npm i -g" armadietto:latest . | ||
# | ||
# RUN: | ||
# | ||
# > docker run --rm -p 8000:8000 rarmadietto:latest | ||
# | ||
# INFO: config.json needs to be byside the Dockerfile | ||
# | ||
# { | ||
# "allow_signup": true, | ||
# "storage_path": "/usr/share/armadietto", | ||
# "cache_views": true, | ||
# "http": { | ||
# "host": "0.0.0.0", | ||
# "port": 8000 | ||
# }, | ||
# "https": { | ||
# "enable": false, | ||
# "force": false, | ||
# "port": 4443, | ||
# "cert": "/etc/letsencrypt/live/example.com/cert.pem", | ||
# "key": "/etc/letsencrypt/live/example.com/privkey.pem" | ||
# }, | ||
# "basePath": "" | ||
# } | ||
# | ||
### |