-
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 #3 from prosenjitjoy/feat/docker
added release workflow
- Loading branch information
Showing
6 changed files
with
57 additions
and
4 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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
CONTAINER_NAME=postgres | ||
POD_NAME=simplebank | ||
BE_CONTAINER=prosenjitjoy/simplebank | ||
DB_CONTAINER=postgres | ||
DB_NAME=bankdb | ||
DB_USER=postgres | ||
DB_PASS=postgres | ||
DATABASE_URL=postgres://postgres:postgres@localhost:5432/bankdb | ||
MIGRATE_URL=pgx5://postgres:postgres@localhost:5432/bankdb | ||
SERVER_ADDR=localhost:5000 | ||
SERVER_ADDR=:5000 | ||
SECRET_KEY=11111111222222223333333344444444 | ||
TOKEN_DURATION=15m |
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,15 @@ | ||
name: Deploy to docker hub | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
name: Build image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: docker build -t prosenjitjoy/simplebank . | ||
- run: echo "${{secrets.DOCKER_PASSWORD}}" | docker login -u ${{secrets.DOCKER_USERNAME}} --password-stdin | ||
- run: docker push prosenjitjoy/simplebank |
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,4 +1,4 @@ | ||
name: ci-test | ||
name: Run unit tests | ||
|
||
on: | ||
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,18 @@ | ||
FROM golang:alpine AS builder | ||
WORKDIR /app | ||
COPY . . | ||
RUN go build -o main cmd/main.go | ||
RUN apk add curl | ||
RUN curl -L https://github.com/golang-migrate/migrate/releases/download/v4.16.2/migrate.linux-amd64.tar.gz | tar xvz | ||
|
||
FROM alpine | ||
WORKDIR /app | ||
COPY --from=builder /app/main . | ||
COPY --from=builder /app/migrate . | ||
COPY database/migration ./migration | ||
COPY start.sh . | ||
COPY .env . | ||
|
||
EXPOSE 5000 | ||
CMD [ "/app/main" ] | ||
ENTRYPOINT ["/app/start.sh"] |
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,9 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
echo "running db migration" | ||
/app/migrate -path /app/migration -database "$DB_SOURCE" -verbose up | ||
|
||
echo "starting the app" | ||
exec "$@" |