-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1、增加 docker 支持,一条命令启动所有服务
- Loading branch information
Showing
10 changed files
with
167 additions
and
46 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 @@ | ||
.vscode | ||
docker/container-data/* | ||
tmp |
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 @@ | ||
## | ||
## Build | ||
## | ||
FROM golang:1.16-alpine AS ohurlshortener_builder | ||
ENV GO111MODULE=on | ||
ENV GOPROXY=https://proxy.golang.com.cn,direct | ||
ADD . /app | ||
WORKDIR /app | ||
RUN go mod download && go build -o ohurlshortener . | ||
|
||
## | ||
## Deploy | ||
## | ||
FROM alpine:latest | ||
WORKDIR /app | ||
COPY --from=ohurlshortener_builder /app/ohurlshortener . | ||
EXPOSE 9092 | ||
ENTRYPOINT ["/app/ohurlshortener","-s","admin","-c","config.ini"] | ||
|
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,21 @@ | ||
[app] | ||
debug = false | ||
port = 9091 | ||
admin_port = 9092 | ||
url_prefix = http://localhost:9091/ | ||
|
||
[redis] | ||
host = redis:6379 | ||
database = 0 | ||
username = | ||
password = | ||
pool_size = 50 | ||
|
||
[postgres] | ||
host = postgres | ||
port = 5432 | ||
user = postgres | ||
password = 0DePm!oG_12Cz^kd_m | ||
database = oh_url_shortener | ||
max_open_conn = 20 | ||
max_idle_conn = 5 |
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,2 +1,2 @@ | ||
# !/bin/bash | ||
docker-compose -p ohurlshortener -f services.yml --env-file vars.env up -d --build | ||
#!/usr/bin/env bash | ||
docker-compose -p ohurlshortener -f services.yml --env-file vars.env up -d --build --force-recreate |
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 @@ | ||
## | ||
## Build | ||
## | ||
FROM golang:1.16-alpine AS ohurlshortener_builder | ||
ENV GO111MODULE=on | ||
ENV GOPROXY=https://proxy.golang.com.cn,direct | ||
ADD . /app | ||
WORKDIR /app | ||
RUN go mod download && go build -o ohurlshortener . | ||
|
||
## | ||
## Deploy | ||
## | ||
FROM alpine:latest | ||
WORKDIR /app | ||
COPY --from=ohurlshortener_builder /app/ohurlshortener . | ||
EXPOSE 9091 | ||
ENTRYPOINT ["/app/ohurlshortener","-s","portal","-c","config.ini"] | ||
|
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,2 +1,2 @@ | ||
# !/bin/bash | ||
#!/usr/bin/env bash | ||
docker-compose -p ohurlshortener -f services.yml --env-file vars.env down |
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,13 +1,19 @@ | ||
# Environment Variables for docker-compose | ||
|
||
# ohUrlShortenerAdmin | ||
OH_ADMIN_PORT=9092 | ||
OH_ADMIN_CONTAINER_NAME=ohurlshortener_admin | ||
|
||
# ohUrlShortenerPortal | ||
OH_PORTAL_PORT=9091 | ||
OH_PORTAL_CONTAINER_NAME=ohurlshortener_portal | ||
|
||
# Postgresql Vars | ||
PG_VERSION=9.6 | ||
PG_CONTAINER_NAME=ohurlshortener_pg | ||
PG_LOCAL_PORT=55432 | ||
PG_SUPER_USER=postgres | ||
PG_SUPER_PWD=0DePm!oG_12Cz^kd_m | ||
|
||
#Redis Vars | ||
RD_VERSION=6.2.6 | ||
RD_CONTAINER_NAME=ohurlshortener_redis | ||
RD_LOCAL_PORT=56379 |
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