-
Notifications
You must be signed in to change notification settings - Fork 5
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 #57 from Caknoooo/task/create-docker-compose-imple…
…mentation feat: docker implementation
- Loading branch information
Showing
3 changed files
with
65 additions
and
1 deletion.
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,12 @@ | ||
DB_HOST = localhost | ||
DB_HOST = <your host> | ||
DB_USER = postgres | ||
DB_PASS = <your password> | ||
DB_NAME = <your database name> | ||
DB_PORT = 5432 | ||
|
||
NGINX_PORT=8080 | ||
GOLANG_PORT=8888 | ||
|
||
SMTP_HOST=smtp.gmail.com | ||
SMTP_PORT=587 | ||
SMTP_SENDER_NAME="Go.Gin.Template <[email protected]>" | ||
|
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,20 @@ | ||
FROM golang:alpine | ||
|
||
RUN apk update && apk upgrade && \ | ||
apk add --no-cache bash | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
COPY . . | ||
|
||
RUN go build -o main . | ||
|
||
RUN go install github.com/cosmtrek/air@latest | ||
|
||
EXPOSE 8888 | ||
|
||
CMD ["air"] |
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,41 @@ | ||
version: '3.9' | ||
|
||
services: | ||
postgres: | ||
hostname: postgres | ||
image: postgres:latest | ||
ports: | ||
- ${DB_PORT}:5432 | ||
volumes: | ||
- ./volumes/postgres:/var/lib/postgresql/data | ||
environment: | ||
- POSTGRES_USER=${DB_USER} | ||
- POSTGRES_PASSWORD=${DB_PASS} | ||
- POSTGRES_DB=${DB_NAME} | ||
networks: | ||
- app-network | ||
|
||
app: | ||
hostname: app | ||
container_name: golang-clean-template | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
ports: | ||
- ${GOLANG_PORT}:${GOLANG_PORT} | ||
restart: always | ||
volumes: | ||
- ./:/app | ||
depends_on: | ||
- postgres | ||
env_file: | ||
- .env | ||
networks: | ||
- app-network | ||
|
||
volumes: | ||
app_vol: | ||
|
||
networks: | ||
app-network: | ||
driver: bridge |