-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
60 lines (45 loc) · 1.72 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
# Define base container
ARG NODE_VER="20"
FROM node:${NODE_VER}-alpine
# Arguments for labels creation
ARG APPLICATION="bms-maps-server"
ARG BUILD_RFC3339="2023-06-30T13:00:00Z"
ARG REVISION="local"
ARG DESCRIPTION="A collaboration server to enable mission preparation for multiplayer missions inside Falcon BMS maps website"
ARG PACKAGE="BenchmarkSims/maps-server"
ARG VERSION="0.1.0"
# Define where application will run
ARG APP_DIR=/opt/node
WORKDIR ${APP_DIR}
# Environment variables passed through container run
ENV \
MAPS_SERVER_PORT="3000"
# Labels creation for container
LABEL org.opencontainers.image.ref.name="${PACKAGE}" \
org.opencontainers.image.created=$BUILD_RFC3339 \
org.opencontainers.image.authors="MaxWaldorf" \
org.opencontainers.image.documentation="/~https://github.com/${PACKAGE}/README.md" \
org.opencontainers.image.description="${DESCRIPTION}" \
org.opencontainers.image.licenses="GPLv3" \
org.opencontainers.image.source="/~https://github.com/${PACKAGE}" \
org.opencontainers.image.revision=$REVISION \
org.opencontainers.image.version=$VERSION \
org.opencontainers.image.url="https://ghcr.io/${PACKAGE}"
# Make sure curl is installed
RUN apk add --no-cache curl
# Create directory
RUN mkdir -p ${APP_DIR}
# Copy application content and proper rights
COPY source ${APP_DIR}
RUN chown -R node:node ${APP_DIR}
# Install missing modules
RUN /usr/local/bin/npm install
# Declare application directory into environment variables
ENV APP_DIR ${APP_DIR}
# Declare container run options
SHELL ["/bin/sh", "-c"]
STOPSIGNAL SIGINT
ENV NODE_DEBUG="net,http,module"
HEALTHCHECK CMD curl -f http://localhost:${MAPS_SERVER_PORT} || false
CMD node ${APP_DIR}/index.js ${MAPS_SERVER_PORT}
EXPOSE ${MAPS_SERVER_PORT}