generated from PenaSide/GolangTemplate
-
This commit is contained in:
parent
74e86a793a
commit
f6926e6c0b
14
Dockerfile
14
Dockerfile
@ -1,27 +1,19 @@
|
||||
# BUILD
|
||||
FROM penahub.gitlab.yandexcloud.net:5050/devops/dockerhub-backup/golang:main.3862 AS build
|
||||
FROM gitea.pena/penadevops/container-images/golang:main as build
|
||||
|
||||
# Update packages and clear cache
|
||||
RUN apk add --no-cache curl
|
||||
# Set work directory
|
||||
WORKDIR /app
|
||||
RUN apk add git
|
||||
# Create binary directory
|
||||
RUN mkdir /app/bin -p
|
||||
# Create golang migrate util directory
|
||||
RUN mkdir /bin/golang-migrate -p
|
||||
# Add migrate tool
|
||||
ADD ./tools/migrate /bin/golang-migrate/
|
||||
# Add main files to app
|
||||
ADD . .
|
||||
RUN git config --global url."https://buildToken:glpat-axA8ttckx3aPf_xd2Dym@penahub.gitlab.yandexcloud.net/".insteadOf "https://penahub.gitlab.yandexcloud.net/"
|
||||
# Download go depences
|
||||
RUN go mod download
|
||||
# Build app
|
||||
RUN GOOS=linux go build -o bin ./...
|
||||
|
||||
# PRODUCTION
|
||||
FROM penahub.gitlab.yandexcloud.net:5050/devops/dockerhub-backup/alpine:main.3862 AS production
|
||||
FROM gitea.pena/penadevops/container-images/alpine:main
|
||||
|
||||
# Install packages
|
||||
RUN apk --no-cache add ca-certificates
|
||||
@ -30,7 +22,5 @@ WORKDIR /app
|
||||
# Copy build file
|
||||
COPY --from=build /app/bin/app ./app
|
||||
COPY ./report.docx ./report.docx
|
||||
# Install migrate tool
|
||||
COPY --from=build /bin/golang-migrate /usr/local/bin
|
||||
# CMD
|
||||
CMD ["./app"]
|
||||
|
@ -68,7 +68,7 @@ func loadConfig() (*models.Config, error) {
|
||||
var config models.Config
|
||||
|
||||
if err := env.Parse(&config); err != nil {
|
||||
log.Fatalf("failed to parse environment variables: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &config, nil
|
||||
|
@ -1,10 +1,8 @@
|
||||
version: "3.3"
|
||||
|
||||
services:
|
||||
customer-app-stagingv1.0.1:
|
||||
hostname: customerv1.0.1
|
||||
container_name: customerv1.0.1
|
||||
image: $CI_REGISTRY_IMAGE/staging:$CI_COMMIT_REF_SLUG.$CI_PIPELINE_ID
|
||||
customerv1.0.1:
|
||||
image: gitea.pena:3000/penaside/customer/staging:$GITHUB_RUN_NUMBER
|
||||
tty: true
|
||||
labels:
|
||||
com.pena.allowed_headers: content-type,authorization,response-type
|
||||
@ -19,7 +17,7 @@ services:
|
||||
# - MONGO_PORT=27017
|
||||
# - MONGO_USER=$MONGO_USER
|
||||
# - MONGO_PASSWORD=$MONGO_PASSWORD
|
||||
- MONGO_URL = TODO
|
||||
- MONGO_URL=mongodb://customer:WAR2Fr6SuPKhtvEp@10.7.0.6:27017/?authSource=customer
|
||||
- MONGO_DB_NAME=customer
|
||||
# - MONGO_AUTH=customer
|
||||
- TELEGRAM_RS_PAY_CHANNEL_ID=-1002338593104
|
||||
|
Loading…
Reference in New Issue
Block a user