-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
65 lines (56 loc) · 2.13 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
FROM quay.io/startx/nodejs:alpine3
ENV SX_VERSION="0.3.66" \
SX_TYPE="service" \
SX_SERVICE="sxapi" \
SX_ID="startx/sxapi" \
SX_NAME="Startx SXAPI (alpine)" \
SX_SUMMARY="Small an eXtensible API framework to build small and flexible microservices using a single configuration file" \
DESCRIPTION="SXAPI $SXAPI_VERSION available as docker container is a base platform for building and running your API projects" \
SX_DEBUG=true \
NODE_ENV=development \
APP_PATH=/app \
APP_PORT=8077 \
CONF_PATH=/conf \
DATA_PATH=/data \
APP_MAIN=/app/app.js
LABEL name="startx/sxapi-$SXAPI_VERSION" \
summary="$SX_SUMMARY" \
description="$DESCRIPTION." \
version="$SXAPI_VERSION" \
release="1" \
maintainer="Startx <[email protected]>" \
help="For more information visit https://github.com/startxfr/sxapi-core" \
io.k8s.description="$DESCRIPTION" \
io.k8s.display-name="$SX_NAME" \
io.openshift.tags="startx,nodejs,sxapi,sxapi-$SXAPI_VERSION" \
io.openshift.non-scalable="false" \
io.openshift.min-memory="64Mi" \
io.openshift.min-cpu="200m" \
io.openshift.expose-services="$APP_PORT:sxapi-http" \
io.openshift.s2i.destination="/tmp" \
io.openshift.s2i.scripts-url="image:///s2i" \
io.s2i.scripts-url="image:///s2i" \
fr.startx.component="$SX_ID:$SXAPI_VERSION"
USER root
COPY ./s2i /s2i
COPY ./core $APP_PATH/core
COPY ./test $APP_PATH/test
COPY ./app.js $APP_PATH/app.js
COPY ./package.json $APP_PATH/package.json
COPY ./sxapi.yml $CONF_PATH/sxapi.yml
RUN apk update && apk upgrade && apk add git python3 make gcc g++ \
&& mkdir -p $APP_PATH $CONF_PATH $DATA_PATH /.npm /.config \
&& cd $APP_PATH \
&& npm run build \
&& npm dedupe \
&& npm cache verify \
&& npm cache clean --force \
&& apk del make gcc g++ \
&& chgrp -R 0 $APP_PATH $CONF_PATH $DATA_PATH /s2i /.npm /.config \
&& chown -R 1001:0 $APP_PATH $CONF_PATH $DATA_PATH /s2i /.npm /.config \
&& chmod -R g=u $APP_PATH $CONF_PATH $DATA_PATH /s2i /.npm /.config
USER 1001
WORKDIR $APP_PATH
EXPOSE $APP_PORT
VOLUME $DATA_PATH
CMD [ "npm" , "run", "test:start" ]