compare icon indicating copy to clipboard operation
compare copied to clipboard

containerisation

Open LeoK80 opened this issue 3 years ago • 0 comments

Type issue: small improvement / portability

Reason: It could potentially improve portability

Solution: I currently have created a local branch from the repository and added a handful of files aimed at building a simple small apache2 httpd server based container to run the project. The created Dockerfile also provides the option to build/run the development server from a container.

new files:

  • Dockerfile
FROM node:14.16.0 as build
RUN mkdir -p /app
WORKDIR /app
COPY . .
RUN npm install && npm run build

FROM build AS develop
CMD [ "npm", "run", "develop" ]

FROM httpd:2.4 AS production

## Configure httpd apache server
COPY container/update-httpd-conf.sh /
RUN chmod 750 /update-httpd-conf.sh
RUN ["/bin/sh", "/update-httpd-conf.sh"]

COPY --from=build /app/build/ /compare/

  • .dockerignore
node_modules
build
*.md
.github
test/*

  • container/update-httpd-config.sh
# Add configuration to the httpd.conf file
cat >> /usr/local/apache2/conf/httpd.conf <<-EOF
DocumentRoot "/compare"
LogLevel debug
<Directory /compare>
  Require all granted
  Header set Access-Control-Allow-Origin "*"
</Directory>
<Files "*.*">
  Require all granted
  Header set Access-Control-Allow-Origin "*"
</Files>
EOF

updated files:

  • README.md sub-section to deploying yourself, describing how to build & run the image/container. sub-section to developing, describing how to build & run the development image/container.

Remarks/other: I've currently tested my implementation locally as well as having successfully deployed it to a Cloud Foundry platform.

LeoK80 avatar Apr 16 '21 15:04 LeoK80