0
Fork 0
mirror of https://codeberg.org/SafeTwitch/safetwitch.git synced 2024-12-22 05:12:57 -05:00
safetwitch/docker/Dockerfile

41 lines
1.4 KiB
Text
Raw Normal View History

2023-07-14 16:16:52 -05:00
# Multi-stage
# 1) Node image for building frontend assets
# 2) nginx stage to serve frontend assets
# Name the node stage "builder"
FROM docker.io/node:16 AS builder
# Set working directory
WORKDIR /app
2024-02-12 21:54:59 -05:00
# Filled with placeholders, later changed and managed
# by the substitute_environment_variables.sh file
2023-07-14 16:16:52 -05:00
ENV SAFETWITCH_BACKEND_DOMAIN SAFETWITCH_BACKEND_DOMAIN_PLACEHOLDER
ENV SAFETWITCH_INSTANCE_DOMAIN SAFETWITCH_INSTANCE_DOMAIN_PLACEHOLDER
ENV SAFETWITCH_HTTPS SAFETWITCH_HTTPS_PLACEHOLDER
2024-02-12 21:54:59 -05:00
ENV SAFETWITCH_DEFAULT_LOCALE SAFETWITCH_DEFAULT_LOCALE_PLACEHOLDER
ENV SAFETWITCH_FALLBACK_LOCALE SAFETWITCH_FALLBACK_LOCALE_PLACEHOLDER
ENV SAFETWITCH_DEFAULT_THEME SAFETWITCH_DEFAULT_THEME_PLACEHOLDER
2024-02-19 11:21:00 -05:00
2023-07-14 16:16:52 -05:00
# Copy all files from current directory to working dir in image
2024-02-19 11:21:00 -05:00
COPY ./ .
RUN ls
2023-07-14 16:16:52 -05:00
# install node modules and build assets
RUN npm i && npm run build
# nginx state for serving content
FROM docker.io/nginx:alpine
2024-02-19 11:21:00 -05:00
COPY ./docker/nginx.conf /etc/nginx/nginx.conf
2023-07-14 16:16:52 -05:00
# Set working directory to nginx asset directory
RUN mkdir /app
# Copy static assets from builder stage
COPY --from=builder /app/dist /app
# Containers run nginx with global directives and daemon off
2024-02-12 21:54:59 -05:00
EXPOSE 8280
2023-07-14 16:16:52 -05:00
# Overriding the default NGINX container behavior
2024-02-19 11:21:00 -05:00
COPY ./docker/substitute_environment_variables.sh ./substitute_environment_variables.sh
2023-07-14 16:16:52 -05:00
RUN chmod +x /substitute_environment_variables.sh
ENTRYPOINT ["/substitute_environment_variables.sh"]