-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from Macktireh/develop
containerize the application and put it on CI github action
- Loading branch information
Showing
3 changed files
with
76 additions
and
0 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,3 @@ | ||
node_modules | ||
.env | ||
.env.example |
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,54 @@ | ||
name: Clone Twittre Frontend | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
|
||
jobs: | ||
push_to_registry: | ||
name: Push Docker image to Docker Hub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build the Docker image | ||
run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/clone-twittre-frontend:latest | ||
|
||
- name: Push the Docker image | ||
run: docker push ${{ secrets.DOCKER_USERNAME }}/clone-twittre-frontend:latest | ||
|
||
# - name: Build and push Docker image | ||
# uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | ||
# with: | ||
# context: . | ||
# file: ./Dockerfile | ||
# push: true | ||
# tags: ${{ steps.meta.outputs.tags }} | ||
# labels: ${{ steps.meta.outputs.labels }} | ||
|
||
# - name: Add remote origin Staging | ||
# if: github.ref == 'refs/heads/main' && job.status == 'success' #we specify that this action will ONLY run if everything up to now is successful- so if theres a fail in the tests, then this will not be deployed. | ||
# run: | | ||
# git remote add heroku https://heroku:${{ secrets.HEROKU_API_KEY }}@git.heroku.com/${{ secrets.HEROKU_APP_NAME_STAGING }}.git | ||
|
||
# - name: Deploy to Heroku Staging | ||
# if: github.ref == 'refs/heads/main' && job.status == 'success' | ||
# run: | | ||
# git push | ||
|
||
# - name: Add remote origin Production | ||
# if: github.ref == 'refs/heads/production' && job.status == 'success' #we specify that this action will ONLY run if everything up to now is successful- so if theres a fail in the tests, then this will not be deployed. | ||
# run: | | ||
# git remote add heroku https://heroku:${{ secrets.HEROKU_API_KEY }}@git.heroku.com/${{ secrets.HEROKU_APP_NAME_PRODUCTION }}.git | ||
|
||
# - name: Deploy to Heroku Production | ||
# if: github.ref == 'refs/heads/production' && job.status == 'success' | ||
# run: | | ||
# git push |
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,19 @@ | ||
FROM node:18-alpine | ||
|
||
LABEL version=v1.0.0 | ||
LABEL app=clone-twitter-frontend | ||
|
||
ENV REACT_APP_API_BASE_URL=http://127.0.0.1:8000 | ||
ENV REACT_APP_DOMAIN_BACKEND=127.0.0.1:8000 | ||
|
||
WORKDIR /app | ||
|
||
COPY package.json . | ||
|
||
RUN npm install | ||
|
||
COPY . . | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["npm", "start"] |