-
Notifications
You must be signed in to change notification settings - Fork 2
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 #35 from GoLembrar/feat-run-with-dockercompose
Feat run with dockercompose
- Loading branch information
Showing
5 changed files
with
103 additions
and
5 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 | ||
dist | ||
.env |
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,56 @@ | ||
name: Build and Push Docker Image | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
|
||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
postgres: | ||
image: postgres:latest | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: test_db | ||
ports: | ||
- 5432:5432 | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Copy .env.example to .env | ||
run: cp .env.example .env | ||
|
||
- name: Log in to Docker hub | ||
uses: docker/[email protected] | ||
with: | ||
username: matheusvictorhenrique | ||
password: Familia26 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build Docker image | ||
run: docker build -t matheusvictorhenrique/go_lembrar_server . | ||
|
||
- name: Tag Docker image | ||
run: | | ||
docker tag matheusvictorhenrique/go_lembrar_server matheusvictorhenrique/go_lembrar_server:latest | ||
docker tag matheusvictorhenrique/go_lembrar_server matheusvictorhenrique/go_lembrar_server:${{ github.run_id }} | ||
- name: Push Docker image | ||
run: | | ||
docker push matheusvictorhenrique/go_lembrar_server:${{ github.run_id }} | ||
docker push matheusvictorhenrique/go_lembrar_server:latest |
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,17 @@ | ||
FROM node:18 | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
|
||
COPY ./.env.example ./env | ||
|
||
COPY package*.json ./ | ||
|
||
RUN npm install | ||
|
||
RUN npm run build | ||
|
||
|
||
|
||
CMD [ "npm", "run", "start: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