Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

containerisation #121

Open
LeoK80 opened this issue Apr 16, 2021 · 0 comments
Open

containerisation #121

LeoK80 opened this issue Apr 16, 2021 · 0 comments

Comments

@LeoK80
Copy link

LeoK80 commented Apr 16, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant