-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (32 loc) · 908 Bytes
/
Dockerfile
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
# syntax=docker/dockerfile:1
# USAGE: docker build -t blokhouse:latest -f Dockerfile .
##
## STEP 1 - BUILD APP
##
# specify the base image to be used for the application, alpine or ubuntu
FROM golang:1.22.3-alpine3.18 AS build
# create a working directory inside the image
WORKDIR /app
#enable v1 dependencies
RUN export GO111MODULE=on
# copy directory files i.e all files ending with .go
COPY . ./
# download Go modules and dependencies
RUN go mod download
# download and install templ
RUN go install github.com/a-h/templ/cmd/templ@latest
RUN go get github.com/a-h/templ/runtime
# compile templates
RUN templ generate
# compile application
RUN go build -o /godocker cmd/blokhouse/main.go
##
## STEP 2 - BUILD CONTAINER
##
FROM scratch
WORKDIR /
COPY --from=build /godocker /godocker
#copy static css,js,images into the container
# COPY static ./static
EXPOSE 8080
ENTRYPOINT ["/godocker"]