38 lines
1.0 KiB
Docker
38 lines
1.0 KiB
Docker
![]() |
# Etapa de compilación
|
||
|
FROM golang:1.23.1-bookworm AS builder
|
||
|
|
||
|
ENV TZ=Europe/Madrid
|
||
|
|
||
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||
|
ADD celsa2048.crt /usr/local/share/ca-certificates/celsa2048.crt
|
||
|
RUN chmod 644 /usr/local/share/ca-certificates/celsa2048.crt
|
||
|
RUN apt-get update \
|
||
|
&& apt-get install -y --no-install-recommends ca-certificates
|
||
|
|
||
|
RUN update-ca-certificates
|
||
|
WORKDIR /app
|
||
|
|
||
|
COPY . .
|
||
|
|
||
|
RUN go get -d -v ./...
|
||
|
|
||
|
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -mod=mod -ldflags "-s -w" -o myapp main.go
|
||
|
|
||
|
# Etapa de producción
|
||
|
|
||
|
FROM debian:stable
|
||
|
ENV TZ=Europe/Madrid
|
||
|
|
||
|
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||
|
ADD celsa2048.crt /usr/local/share/ca-certificates/celsa2048.crt
|
||
|
RUN chmod 644 /usr/local/share/ca-certificates/celsa2048.crt
|
||
|
RUN apt-get update \
|
||
|
&& apt-get install -y --no-install-recommends ca-certificates
|
||
|
ADD assets /root/
|
||
|
ADD templates /root/
|
||
|
RUN update-ca-certificates
|
||
|
WORKDIR /root/
|
||
|
|
||
|
COPY --from=builder /app/myapp .
|
||
|
|
||
|
CMD ["./myapp"]
|