-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: Add multistage.Dockerfile for building and deploying the frontend * ci: Add GitHub Actions pipeline for building and pushing Docker image * fix: Update Build Docker image Step * refactor: Remove unnecessary steps * refactor: Add Node, npm setting steps * ci: update * Changed branch name from 'ci/docker-ci-pipeline' to 'main' * refactor: Reorganized and simplified the workflow steps * ci: Added a step to create a GitHub release with release notes. * ci: Update trigger
- Loading branch information
1 parent
17bc32b
commit 12cbdc1
Showing
2 changed files
with
68 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,55 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Create src/global/url.js | ||
run: | | ||
echo "const SOCIAL_LOGIN_URL = {" > src/global/url.js | ||
echo " KAKAO: '${{ secrets.KAKAO }}'," >> src/global/url.js | ||
echo " NAVER: '${{ secrets.NAVER }}'," >> src/global/url.js | ||
echo " GOOGLE: '${{ secrets.GOOGLE }}'," >> src/global/url.js | ||
echo " FACEBOOK: '${{ secrets.FACEBOOK }}'," >> src/global/url.js | ||
echo "};" >> src/global/url.js | ||
echo "export { SOCIAL_LOGIN_URL };" >> src/global/url.js | ||
- name: Login to GitHub Container Registry | ||
run: echo ${{ secrets.GTOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
|
||
- name: Create Release Name | ||
id: release_name | ||
run: | | ||
echo "::set-output name=release_name::v-$(date +'%Y.%m.%d-%H%M%S')" | ||
- name: Build and Push Docker image | ||
run: | | ||
RELEASE_NAME="${{ steps.release_name.outputs.release_name }}" | ||
docker build -t my-frontend-app -f multistage.Dockerfile . | ||
docker tag my-frontend-app ghcr.io/liberty52/liberty52-front-end:dev-$RELEASE_NAME | ||
echo ${{ secrets.GTOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin | ||
docker push ghcr.io/liberty52/liberty52-front-end:dev-$RELEASE_NAME | ||
working-directory: ./ | ||
|
||
- name: Create GitHub Release | ||
uses: actions/create-release@v1 | ||
with: | ||
tag_name: ${{ steps.release_name.outputs.release_name }} | ||
release_name: Release ${{ steps.release_name.outputs.release_name }} | ||
generateReleaseNotes: true | ||
draft: false | ||
prerelease: false | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GTOKEN }} | ||
|
||
- name: Clean up | ||
run: docker logout ghcr.io |
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,13 @@ | ||
FROM node:16 AS build | ||
WORKDIR /app | ||
COPY package*.json ./ | ||
RUN npm install --production | ||
COPY . . | ||
RUN npm run build | ||
|
||
FROM nginx:stable-alpine | ||
RUN rm -rf /etc/nginx/conf.d | ||
COPY conf /etc/nginx | ||
COPY --from=build /app/build /usr/share/nginx/html | ||
EXPOSE 80 | ||
CMD ["nginx", "-g", "daemon off;"] |