2022-01-14 05:24:37 +08:00
|
|
|
# There's an issue with node:16-alpine.
|
|
|
|
# On Raspberry Pi, the following crash happens:
|
2021-05-22 17:12:26 +08:00
|
|
|
|
2022-01-14 05:24:37 +08:00
|
|
|
# #FailureMessage Object: 0x7e87753c
|
|
|
|
# #
|
|
|
|
# # Fatal error in , line 0
|
|
|
|
# # unreachable code
|
|
|
|
# #
|
|
|
|
# #
|
|
|
|
# #
|
|
|
|
|
|
|
|
FROM docker.io/library/node:14-alpine@sha256:dc92f36e7cd917816fa2df041d4e9081453366381a00f40398d99e9392e78664 AS build_node_modules
|
2021-05-22 17:12:26 +08:00
|
|
|
|
2021-05-23 20:28:22 +08:00
|
|
|
# Copy Web UI
|
2021-05-23 18:02:56 +08:00
|
|
|
COPY src/ /app/
|
|
|
|
WORKDIR /app
|
|
|
|
RUN npm ci --production
|
2022-01-14 05:24:37 +08:00
|
|
|
|
|
|
|
# Copy build result to a new image.
|
|
|
|
# This saves a lot of disk space.
|
|
|
|
FROM docker.io/library/node:14-alpine@sha256:dc92f36e7cd917816fa2df041d4e9081453366381a00f40398d99e9392e78664
|
|
|
|
COPY --from=build_node_modules /app /app
|
|
|
|
|
|
|
|
# Move node_modules one directory up, so during development
|
|
|
|
# we don't have to mount it in a volume.
|
|
|
|
# This results in much faster reloading!
|
|
|
|
#
|
|
|
|
# Also, some node_modules might be native, and
|
|
|
|
# the architecture & OS of your development machine might differ
|
|
|
|
# than what runs inside of docker.
|
|
|
|
RUN mv /app/node_modules /node_modules
|
|
|
|
|
|
|
|
# Enable this to run `npm run serve`
|
2021-11-12 04:02:07 +08:00
|
|
|
RUN npm i -g nodemon
|
2022-01-14 05:24:37 +08:00
|
|
|
|
|
|
|
# Install Linux packages
|
|
|
|
RUN apk add -U --no-cache \
|
|
|
|
wireguard-tools \
|
|
|
|
dumb-init
|
2021-05-23 18:02:56 +08:00
|
|
|
|
2021-05-23 20:28:22 +08:00
|
|
|
# Expose Ports
|
2021-05-23 18:02:56 +08:00
|
|
|
EXPOSE 51820/udp
|
2021-06-02 18:29:42 +08:00
|
|
|
EXPOSE 51821/tcp
|
2021-05-23 20:28:22 +08:00
|
|
|
|
|
|
|
# Set Environment
|
2021-05-23 18:02:56 +08:00
|
|
|
ENV DEBUG=Server,WireGuard
|
2021-05-23 20:28:22 +08:00
|
|
|
|
|
|
|
# Run Web UI
|
2022-01-14 05:24:37 +08:00
|
|
|
WORKDIR /app
|
2021-09-16 09:35:37 +08:00
|
|
|
CMD ["/usr/bin/dumb-init", "node", "server.js"]
|