-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (35 loc) · 1.11 KB
/
Dockerfile
File metadata and controls
53 lines (35 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
## Source code + build dependencies base image
FROM golang:1.20-alpine AS source
# set timezone to avoid postgres issues
RUN apk add -U tzdata
ENV TZ=Europe/Kiev
RUN cp /usr/share/zoneinfo/Europe/Kiev /etc/localtime
# Set the working directory inside the container
WORKDIR /go/src/vilnaCMS
RUN go env -w CGO_ENABLED="0"
# Copy the Go application files to the container
COPY . .
# Install dependencies (if any)
RUN go mod download && go mod verify
## Dev image with live reloading + debugger
FROM source AS dev
RUN go install github.com/go-delve/delve/cmd/dlv@latest && \
go install github.com/cosmtrek/air@latest
ENTRYPOINT air
## Build image
FROM source AS build
# build binary
RUN go build -ldflags="-s -w" -o /bin/app
## Serve image
FROM alpine:latest AS serve
# Set timezone to avoid postgres issues
RUN apk add -U tzdata
ENV TZ=Europe/Kiev
RUN cp /usr/share/zoneinfo/Europe/Kiev /etc/localtime
# Copy binary
COPY --from=build /bin/app /app
# ----------------------
# Add specific db config if needed
# ----------------------
COPY --from=build /go/src/vilnaCMS/local/conf.json /local/conf.json
ENTRYPOINT ["/app"]