generated from hackforla/.github-hackforla-base-repo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release-1.0.40' into main
- Loading branch information
Showing
43 changed files
with
2,217 additions
and
466 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Deploy develop branch to foodoasisdev.herokuapp.com | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: akhileshns/[email protected] # This is the action | ||
with: | ||
heroku_api_key: ${{secrets.HEROKU_API_KEY}} | ||
heroku_app_name: "foodoasisdev" #Must be unique in Heroku | ||
heroku_email: "[email protected]" | ||
usedocker: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,44 @@ | ||
# build and push a docker image from the latest push to "develop" branch | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
release: | ||
types: | ||
- published | ||
jobs: | ||
webapi: | ||
runs-on: ubuntu-latest | ||
name: build & push image | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
- name: build-and-push-image | ||
uses: docker/build-push-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
repository: foodoasisla/foodoasisla | ||
tag_with_ref: true | ||
tag_with_sha: true | ||
add_git_labels: true | ||
labels: description="Food Oasis LA",maintained="[email protected]" | ||
fullstack: | ||
runs-on: ubuntu-latest | ||
name: build & push image | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
- name: build-and-push-image | ||
uses: docker/build-push-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
repository: foodoasisla/foodoasisla | ||
dockerfile: ./Dockerfile-fullstack | ||
tag_with_ref: true | ||
tag_with_sha: true | ||
add_git_labels: true | ||
labels: description="Food Oasis LA",maintained="[email protected]" | ||
# build and push a docker image from the latest push to "develop" branch | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
release: | ||
types: | ||
- published | ||
jobs: | ||
webapi: | ||
runs-on: ubuntu-latest | ||
name: build & push image | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
- name: build-and-push-image | ||
uses: docker/build-push-action@v1 | ||
with: | ||
dockerfile: ./Dockerfile-jared | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
repository: foodoasisla/foodoasisla | ||
tag_with_ref: true | ||
tag_with_sha: true | ||
add_git_labels: true | ||
labels: description="Food Oasis LA",maintained="[email protected]" | ||
fullstack: | ||
runs-on: ubuntu-latest | ||
name: build & push image | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
- name: build-and-push-image | ||
uses: docker/build-push-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
repository: foodoasisla/foodoasisla | ||
dockerfile: ./Dockerfile | ||
tag_with_ref: true | ||
tag_with_sha: true | ||
add_git_labels: true | ||
labels: description="Food Oasis LA",maintained="[email protected]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: Deploy main branch to foodoasis.herokuapp.com | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: akhileshns/[email protected] # This is the action | ||
with: | ||
heroku_api_key: ${{secrets.HEROKU_API_KEY}} | ||
heroku_app_name: "foodoasis" #Must be unique in Heroku | ||
heroku_email: "[email protected]" | ||
usedocker: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,45 @@ | ||
FROM jred/nodejs:12.17 as builder | ||
LABEL maintainer="[email protected]" | ||
LABEL description="Nodejs docker base image" | ||
|
||
|
||
FROM node:12.17-buster-slim | ||
LABEL maintainer.fola="[email protected]" | ||
LABEL org.hackforla="Hack For LA" | ||
LABEL description="Food Oasis app" | ||
|
||
ENV NODE_ENV "development" | ||
|
||
COPY --from=builder /usr/local/bin/ /usr/local/bin/ | ||
|
||
WORKDIR /fola | ||
COPY package.json ./ | ||
COPY package-lock.json ./ | ||
RUN npm ci | ||
|
||
# TODO @jafow re-structure directory heirarchy so we can flatten these down | ||
COPY middleware/ ./middleware | ||
COPY app/ ./app | ||
COPY server.js ./ | ||
COPY db/config.js ./db/ | ||
COPY entrypoint.sh ./ | ||
|
||
# we dont want to run as sudo so create group and user | ||
RUN groupadd -r fola && useradd --no-log-init -r -g fola fola | ||
USER fola | ||
|
||
EXPOSE 5000 | ||
|
||
ENTRYPOINT ["./entrypoint.sh"] | ||
CMD ["node", "server.js"] | ||
FROM node:alpine as clientBuilder | ||
|
||
ENV NODE_ENV "development" | ||
|
||
RUN mkdir /app | ||
WORKDIR /app | ||
COPY client/package.json . | ||
COPY client/package-lock.json . | ||
RUN npm ci | ||
COPY client . | ||
|
||
RUN npm run build | ||
RUN echo package.json | ||
|
||
# Server Container | ||
FROM node:12-buster-slim | ||
LABEL maintainer.fola="[email protected]" | ||
LABEL org.hackforla="Hack For LA" | ||
LABEL description="Food Oasis app" | ||
|
||
WORKDIR /fola | ||
COPY package.json ./ | ||
COPY package-lock.json ./ | ||
RUN npm ci | ||
|
||
# TODO @jafow re-structure directory heirarchy so we can flatten these down | ||
COPY middleware/ ./middleware | ||
COPY app/ ./app | ||
COPY server.js ./ | ||
#COPY db/config.js ./db/ | ||
COPY --from=clientBuilder /app/build ./client/build | ||
|
||
#COPY entrypoint.sh ./ | ||
|
||
# we dont want to run as sudo so create group and user | ||
RUN groupadd -r fola && useradd --no-log-init -r -g fola fola | ||
USER fola | ||
|
||
EXPOSE 5000 | ||
|
||
ENTRYPOINT ["/usr/local/bin/node", "server.js"] | ||
|
||
# TODO: Make this into a full-stack docker container script | ||
#ENTRYPOINT ["./entrypoint.sh"] | ||
#CMD ["node", "server.js"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM jred/nodejs:12.17 as builder | ||
LABEL maintainer="[email protected]" | ||
LABEL description="Nodejs docker base image" | ||
|
||
|
||
FROM node:12.17-buster-slim | ||
LABEL maintainer.fola="[email protected]" | ||
LABEL org.hackforla="Hack For LA" | ||
LABEL description="Food Oasis app" | ||
|
||
ENV NODE_ENV "development" | ||
|
||
COPY --from=builder /usr/local/bin/ /usr/local/bin/ | ||
|
||
WORKDIR /fola | ||
COPY package.json ./ | ||
COPY package-lock.json ./ | ||
RUN npm ci | ||
|
||
# TODO @jafow re-structure directory heirarchy so we can flatten these down | ||
COPY middleware/ ./middleware | ||
COPY app/ ./app | ||
COPY server.js ./ | ||
COPY db/config.js ./db/ | ||
COPY entrypoint.sh ./ | ||
|
||
# we dont want to run as sudo so create group and user | ||
RUN groupadd -r fola && useradd --no-log-init -r -g fola fola | ||
USER fola | ||
|
||
EXPOSE 5000 | ||
|
||
ENTRYPOINT ["./entrypoint.sh"] | ||
CMD ["node", "server.js"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const downloadFile = (req, res) => { | ||
try { | ||
const file = `${process.cwd()}/uploads/template.csv`; | ||
res.download(file); | ||
} catch (err) { | ||
console.error(err.message); | ||
} | ||
}; | ||
|
||
module.exports = { | ||
downloadFile, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const router = require("express").Router(); | ||
const jwtSession = require("../../middleware/jwt-session"); | ||
const exportController = require("../controllers/export-controller"); | ||
|
||
router.get( | ||
"/csv-template", | ||
jwtSession.validateUserHasRequiredRoles(["admin"]), | ||
exportController.downloadFile | ||
); | ||
|
||
module.exports = router; |
Oops, something went wrong.