Skip to content

Commit 02226d7

Browse files
authored
Merge pull request #20 from Capstone-Projects-2022-Spring/AN-122-dockerize-anemone
AN-122 dockerize anemone
2 parents 2d34d97 + a108cc3 commit 02226d7

2 files changed

Lines changed: 83 additions & 0 deletions

File tree

anemone-app/.dockerignore

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
### Node template
2+
# Logs
3+
logs
4+
*.log
5+
npm-debug.log*
6+
yarn-debug.log*
7+
yarn-error.log*
8+
lerna-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Compiled binary addons (https://nodejs.org/api/addons.html)
20+
build/Release
21+
22+
# Dependency directories
23+
node_modules/
24+
jspm_packages/
25+
26+
# Optional npm cache directory
27+
.npm
28+
29+
# Output of 'npm pack'
30+
*.tgz
31+
32+
# Yarn Integrity file
33+
.yarn-integrity
34+
35+
# dotenv environment variables file
36+
.env
37+
.env.test
38+
39+
# Next.js build output
40+
.next
41+
out
42+
43+
# Serverless directories
44+
.serverless/
45+
46+
# Stores VSCode versions used for testing VSCode extensions
47+
.vscode-test
48+
49+
# yarn v2
50+
.yarn/cache
51+
.yarn/unplugged
52+
.yarn/build-state.yml
53+
.yarn/install-state.gz
54+
.pnp.*

anemone-app/Dockerfile

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This Dockerfile builds and deploys a production ready version of your ReactJS App.
2+
# This could be automated using GitHub Actions to build the project and deliver it to Docker Hub.
3+
4+
# pull official base image
5+
FROM node:17.8.0-alpine3.14 as build
6+
7+
8+
# set working directory
9+
WORKDIR /app
10+
11+
# add `/app/node_modules/.bin` to $PATH
12+
ENV PATH /app/node_modules/.bin:$PATH
13+
14+
# install app dependencies
15+
COPY ./anemone-app/package.json ./
16+
COPY ./anemone-app/package-lock.json ./
17+
RUN npm install
18+
RUN npm install react-scripts@3.4.1 -g --silent
19+
20+
# add app
21+
COPY ./anemone-app ./
22+
RUN npm run build
23+
24+
# this next stage is the final deliverable. It is just a simple
25+
# apache2 server with our built application (build/) being served on port 80.
26+
# production stage
27+
FROM httpd:2.4-alpine as production-stage
28+
COPY --from=build /app/build /usr/local/apache2/htdocs/
29+
EXPOSE 80

0 commit comments

Comments
 (0)