1
0
Fork 0
mirror of https://codeberg.org/ashley/poke.git synced 2024-11-17 05:54:42 -05:00
poke/p/Dockerfile

99 lines
2.8 KiB
Docker
Raw Normal View History

#################################################################################
# INSTALLERS #
# These images provide the dependencies required to build the other images. #
#################################################################################
FROM quay.io/almalinuxorg/9-base AS builder-installer
# Needed for node 18+
# RUN dnf module --assumeyes enable nodejs
RUN --mount=type=cache,target=/var/cache/dnf \
dnf install --assumeyes --nodocs nodejs ca-certificates jq make gcc g++
RUN npm install -g \
npm@$(curl "https://release-monitoring.org/api/v2/versions/?project_id=190206" | jq --raw-output '.stable_versions[0]')
# Runtime dependencies
FROM quay.io/almalinuxorg/9-base AS installer
COPY --from=quay.io/almalinuxorg/9-micro / /rpms
RUN --mount=type=cache,target=/var/cache/dnf \
dnf install --assumeyes \
--installroot /rpms \
--releasever=9 \
--setopt=install_weak_deps=false \
--nodocs \
nodejs ca-certificates
RUN dnf clean all \
--installroot /rpms
# Proxy + certbot
FROM quay.io/almalinuxorg/9-base AS proxy-installer
RUN dnf install epel-release --assumeyes
COPY --from=quay.io/almalinuxorg/9-micro / /rpms
RUN --mount=type=cache,target=/var/cache/dnf \
dnf install --assumeyes \
--installroot /rpms \
--releasever=9 \
--setopt=install_weak_deps=false \
--setopt=reposdir=/etc/yum.repos.d \
--nodocs \
nginx-core certbot python3-certbot-nginx
RUN dnf clean all \
--installroot /rpms
#################################################################################
# BUILDER #
#################################################################################
FROM builder-installer AS builder
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY package.json ./
2022-12-19 12:05:16 -05:00
RUN npm install --frozen-lockfile
2023-01-02 00:28:35 -05:00
# COPY ./ ./
COPY p/server.js ./
#################################################################################
# FINAL IMAGE #
#################################################################################
FROM quay.io/almalinuxorg/9-micro AS release-base
# Grab npm
COPY --from=installer /rpms /
# Grab site
COPY --from=builder /usr/src/app /app
WORKDIR /app
2022-12-19 12:05:16 -05:00
ENV NODE_ENV production
# Final image
FROM release-base as release
# EXPOSE 3000/tcp
2022-12-30 16:48:17 -05:00
CMD [ "node", "server.js" ]
# Final image with extras
FROM release-base AS release-aio
# Grab nginx and certbot
COPY --from=proxy-installer /rpms /
2022-12-30 16:48:17 -05:00
COPY entrypoint.sh entrypoint.sh
RUN chmod +x entrypoint.sh
2022-12-30 16:48:17 -05:00
COPY nginx.conf.example /etc/nginx/conf.d/poketube.conf
# EXPOSE 80/tcp
# EXPOSE 443/tcp
ENTRYPOINT [ "/usr/bin/bash", "./entrypoint.sh" ]
CMD [ "node", "server.js" ]