diff --git a/Dockerfile b/Dockerfile index f0f5f71..9a499a8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,19 +2,26 @@ FROM golang:1.25-alpine AS builder WORKDIR /src +RUN apk add --no-cache git build-base + COPY go.mod go.sum ./ RUN go mod download COPY . . -RUN go build -o /fes main.go +ENV CGO_ENABLED=0 +ENV GOOS=linux +ENV GOARCH=amd64 -FROM alpine:latest +RUN go build -ldflags="-X fes/modules/version.gitCommit=$(git rev-parse --short HEAD) -s -w" -o fes -RUN apk add --no-cache bash lua5.4 +FROM scratch -COPY --from=builder /fes /usr/local/bin/fes +COPY --from=builder /src/fes /fes WORKDIR /app -CMD ["fes", "run", "/app"] +EXPOSE 8080 + +ENTRYPOINT ["/fes"] +CMD ["run", "/app"] diff --git a/examples/hello-with-docker/Dockerfile b/examples/hello-with-docker/Dockerfile deleted file mode 100644 index b8b3f9e..0000000 --- a/examples/hello-with-docker/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM fes:latest - -COPY . /app - -WORKDIR /app - -CMD ["fes", "run", "/app"] diff --git a/examples/hello-with-docker/Fes.toml b/examples/hello-with-docker/app/Fes.toml similarity index 100% rename from examples/hello-with-docker/Fes.toml rename to examples/hello-with-docker/app/Fes.toml diff --git a/examples/hello-with-docker/www/index.lua b/examples/hello-with-docker/app/www/index.lua similarity index 100% rename from examples/hello-with-docker/www/index.lua rename to examples/hello-with-docker/app/www/index.lua diff --git a/examples/hello-with-docker/docker-compose.yml b/examples/hello-with-docker/docker-compose.yml new file mode 100644 index 0000000..8ad387a --- /dev/null +++ b/examples/hello-with-docker/docker-compose.yml @@ -0,0 +1,7 @@ +services: + hello: + image: git.vxserver.dev/fsd/fes:latest + ports: + - "3000:3000" + volumes: + - ./app:/app