Skip to content

Commit

Permalink
Update to use httpd
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesPeck committed Feb 13, 2024
1 parent 3195fca commit 583a19a
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.DS_Store
node_modules
/build
/cert
/.svelte-kit
/playwright-report
/package
Expand All @@ -11,3 +12,5 @@ node_modules
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
.vscode
/certs
/httpd-docker-logs
26 changes: 23 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Step 1: Build the app with node
FROM node:20.9.0-alpine3.18 AS builder
WORKDIR /app
COPY package*.json .
Expand All @@ -6,11 +7,30 @@ COPY . .
RUN npm run build
RUN npm ci --omit dev

FROM node:20.9.0-alpine3.18
# Step 2: Serve the app with httpd
FROM httpd:2.4.54-alpine

RUN apk add --update openssl sed nodejs supervisor
#TODO: volume mount the certs
RUN mkdir -p ${HTTPD_PREFIX}/cert
COPY cert ${HTTPD_PREFIX}/cert
COPY httpd-vhosts.conf ${HTTPD_PREFIX}/conf/extra/httpd-vhosts.conf

RUN sed -i '/^#Include conf.extra.httpd-vhosts.conf/s/^#//' ${HTTPD_PREFIX}/conf/httpd.conf

RUN sed -i '/^#LoadModule proxy_module/s/^#//' ${HTTPD_PREFIX}/conf/httpd.conf
RUN sed -i '/^#LoadModule proxy_http_module/s/^#//' ${HTTPD_PREFIX}/conf/httpd.conf
RUN sed -i '/^#LoadModule proxy_connect_module/s/^#//' ${HTTPD_PREFIX}/conf/httpd.conf

RUN sed -i '/^#LoadModule ssl_module modules\/mod_ssl.so/s/^#//' ${HTTPD_PREFIX}/conf/httpd.conf
RUN sed -i '/^#LoadModule rewrite_module modules\/mod_rewrite.so/s/^#//' ${HTTPD_PREFIX}/conf/httpd.conf
RUN sed -i '/^#LoadModule socache_shmcb_module modules\/mod_socache_shmcb.so/s/^#//' ${HTTPD_PREFIX}/conf/httpd.conf
RUN mkdir -p /usr/local/apache2/logs/ssl_mutex

WORKDIR /app
COPY --from=builder /app/build build/
COPY --from=builder /app/node_modules node_modules/
COPY package.json .
EXPOSE 3000
ENV NODE_ENV=production
CMD [ "node", "build" ]
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
16 changes: 16 additions & 0 deletions Dockerfile.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:20.9.0-alpine3.18 AS builder
WORKDIR /app
COPY package*.json .
RUN npm ci
COPY . .
RUN npm run build
RUN npm ci --omit dev

FROM node:20.9.0-alpine3.18
WORKDIR /app
COPY --from=builder /app/build build/
COPY --from=builder /app/node_modules node_modules/
COPY package.json .
EXPOSE 3000
ENV NODE_ENV=production
CMD [ "node", "build" ]
10 changes: 10 additions & 0 deletions supervisord.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[supervisord]
nodaemon=true

[program:httpd]
command=httpd-foreground

[program:node]
command=node build
directory=/app

0 comments on commit 583a19a

Please sign in to comment.