Compare commits
No commits in common. "c4fa24867c997a8e5480987077ff1542acbc777d" and "1b2bc7708e3cb380b5fe38ea8dc623800301daaa" have entirely different histories.
c4fa24867c
...
1b2bc7708e
@ -31,7 +31,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
registry: git.gocommunity.ru
|
registry: git.gocommunity.ru
|
||||||
username: ${{ secrets.USER }}
|
username: ${{ secrets.USER }}
|
||||||
password: ${{ secrets.PASSW }}
|
password: ${{ secrets.TOKEN }}
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
|
|||||||
36
Dockerfile
36
Dockerfile
@ -1,36 +0,0 @@
|
|||||||
# Build stage
|
|
||||||
FROM golang:1.25-alpine AS builder
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
COPY go.mod go.sum ./
|
|
||||||
RUN go mod download
|
|
||||||
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o main ./cmd/.
|
|
||||||
|
|
||||||
# Final stage
|
|
||||||
FROM alpine:latest
|
|
||||||
RUN apk --no-cache add ca-certificates
|
|
||||||
|
|
||||||
WORKDIR /root/
|
|
||||||
COPY --from=builder /app/main .
|
|
||||||
|
|
||||||
# Создать директорию для приложения
|
|
||||||
WORKDIR /app
|
|
||||||
COPY --from=builder /app/main .
|
|
||||||
|
|
||||||
# Создать non-root пользователя для безопасности
|
|
||||||
RUN addgroup -g 1001 -S appuser && \
|
|
||||||
adduser -u 1001 -S appuser -G appuser && \
|
|
||||||
chown -R appuser:appuser /app
|
|
||||||
|
|
||||||
USER appuser
|
|
||||||
|
|
||||||
# Установить переменные окружения
|
|
||||||
ENV PORT=8080
|
|
||||||
ENV HOST=0.0.0.0
|
|
||||||
|
|
||||||
|
|
||||||
EXPOSE 8080
|
|
||||||
CMD ["./main"]
|
|
||||||
@ -12,7 +12,6 @@ func main() {
|
|||||||
http.HandleFunc("/", helloHandler)
|
http.HandleFunc("/", helloHandler)
|
||||||
http.HandleFunc("/health", healthHandler)
|
http.HandleFunc("/health", healthHandler)
|
||||||
|
|
||||||
// port := "8080"
|
|
||||||
port := os.Getenv("PORT")
|
port := os.Getenv("PORT")
|
||||||
if port == "" {
|
if port == "" {
|
||||||
port = "8080"
|
port = "8080"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user