customer/Dockerfile

37 lines
1.0 KiB
Docker
Raw Normal View History

2023-06-22 09:36:43 +00:00
# BUILD
2024-10-20 13:05:09 +00:00
FROM penahub.gitlab.yandexcloud.net:5050/devops/dockerhub-backup/golang:main.3862 AS build
2023-06-22 09:36:43 +00:00
2023-09-14 10:07:28 +00:00
# Update packages and clear cache
2023-11-01 07:56:05 +00:00
RUN apk add --no-cache curl
2023-09-14 10:07:28 +00:00
# Set work directory
WORKDIR /app
RUN apk add git
2023-09-14 10:07:28 +00:00
# Create binary directory
2023-06-22 09:36:43 +00:00
RUN mkdir /app/bin -p
2023-09-14 10:07:28 +00:00
# Create golang migrate util directory
2023-06-22 09:36:43 +00:00
RUN mkdir /bin/golang-migrate -p
2023-09-14 10:07:28 +00:00
# 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/"
2023-11-06 07:34:07 +00:00
# Download go depences
2024-04-15 12:12:21 +00:00
RUN go mod download
2023-06-22 09:36:43 +00:00
# Build app
RUN GOOS=linux go build -o bin ./...
# PRODUCTION
2024-10-20 13:05:09 +00:00
FROM penahub.gitlab.yandexcloud.net:5050/devops/dockerhub-backup/alpine:main.3862 AS production
2023-06-22 09:36:43 +00:00
# Install packages
2023-11-02 12:28:24 +00:00
RUN apk --no-cache add ca-certificates
2023-06-22 09:36:43 +00:00
# Create home directory
WORKDIR /app
# Copy build file
COPY --from=build /app/bin/app ./app
2024-05-15 17:56:29 +00:00
COPY ./report.docx ./report.docx
2023-06-22 09:36:43 +00:00
# Install migrate tool
COPY --from=build /bin/golang-migrate /usr/local/bin
# CMD
CMD ["./app"]