-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
64 lines (45 loc) · 1.5 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
FROM node:16 AS APP_BUILDER
LABEL maintainer="ITK Dev <itkdev@mkb.aarhus.dk>"
ARG APP_VERSION="develop"
ARG UID=101
ARG GID=101
ENV APP_PATH=/app
ADD https://github.com/os2display/display-admin-client/archive/${APP_VERSION}.tar.gz /tmp/app.tar
RUN mkdir -p ${APP_PATH} \
&& tar -zxf /tmp/app.tar --strip-components=1 -C ${APP_PATH} \
&& rm /tmp/app.tar
WORKDIR ${APP_PATH}
# Build it.
RUN yarn install \
&& yarn build
# Remove fixtures
RUN rm -rf public/fixtures
####
## Build main application image.
####
FROM nginxinc/nginx-unprivileged:alpine
LABEL maintainer="ITK Dev <itkdev@mkb.aarhus.dk>"
ENV APP_PATH=/var/www/html
ARG APP_VERSION="develop"
ARG APP_RELEASE_VERSION="develop"
ARG APP_RELEASE_TIMESTAMP=0
ARG APP_RELEASE_TIME=0
ENV APP_PATH=/var/www/html
USER root
# Install the application.
COPY --from=APP_BUILDER /app/build ${APP_PATH}
# Copy configuration.
COPY etc /etc/
# Create release file
RUN echo "{\"releaseTimestamp\": $APP_RELEASE_TIMESTAMP, \"releaseTime\": \"$APP_RELEASE_TIME\", \"releaseVersion\": \"$APP_RELEASE_VERSION\"}" > ${APP_PATH}/release.json
# Install configuration template handler
ADD https://github.com/kelseyhightower/confd/releases/download/v0.16.0/confd-0.16.0-linux-amd64 /usr/local/bin/confd
RUN chmod +x /usr/local/bin/confd
COPY docker-entrypoint.sh /
RUN chmod +x /docker-entrypoint.sh \
&& chown -R $UID:0 ${APP_PATH} \
&& chmod -R g+w ${APP_PATH}
USER $UID
WORKDIR ${APP_PATH}
EXPOSE 8080
CMD [ "/docker-entrypoint.sh", "nginx", "-g daemon off;" ]