-
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.
* ♻️ Refactor: Use WORKDIR instead of USER * Add compose.prod.yml and deploy.yml
- Loading branch information
Showing
6 changed files
with
34 additions
and
14 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,19 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
deploy: | ||
name: deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Deploy | ||
run: | | ||
echo "${{ secrets.EC2_SSH_KEY }}" > ssh_key | ||
chmod 600 ssh_key | ||
ssh -oStrictHostKeyChecking=no -i ssh_key [email protected] "cd /home/ubuntu/pong && git checkout main && git pull origin main && make prod" |
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,15 +1,7 @@ | ||
FROM node:20 | ||
|
||
RUN useradd --user-group --create-home --shell /bin/false backend &&\ | ||
npm install --global npm | ||
WORKDIR /app | ||
|
||
ENV HOME=/home/backend | ||
COPY package.json ./ | ||
|
||
COPY package.json $HOME/api/ | ||
RUN chown -R backend:backend $HOME/* | ||
|
||
USER backend | ||
WORKDIR $HOME/api | ||
RUN npm install | ||
|
||
CMD ["yarn", "start"] | ||
RUN yarn install |
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,3 +1,3 @@ | ||
services: | ||
backend: | ||
command: ["yarn", "start:dev"] | ||
command: yarn start:dev |
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,4 @@ | ||
services: | ||
web: | ||
ports: | ||
- "80:80" |
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