Skip to content

Commit

Permalink
deploy: build arg static dir
Browse files Browse the repository at this point in the history
  • Loading branch information
dartt0n committed Sep 19, 2024
1 parent 65044e0 commit 2fb964d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ import (
type Config struct {
Addr string `koanf:"addr" validate:"required" json:"addr"`
StaticDir string `koanf:"static_dir" validate:"required" json:"static_dir"`
Debug bool `koanf:"debug" validate:"required" json:"debug"`
Debug bool `koanf:"debug" validate:"" json:"debug"`
}

func main() {
// read config
conf := Config{
// default options
Addr: ":8080",
StaticDir: "/var/www/static",
Debug: false,
StaticDir: "./controllers/web/static",
Debug: true,
}

k := koanf.New(".")
Expand Down
7 changes: 4 additions & 3 deletions dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ COPY package.json package-lock.json tailwind.config.js ./
RUN npm install
COPY controllers/web/components/*.templ ./controllers/web/components/
COPY controllers/web/static/index.css ./controllers/web/static/
RUN npx tailwindcss -i ./controllers/web/static/index.css -o ./controllers/web/static/output.css
RUN npx tailwindcss -i ./controllers/web/static/index.css -o ./static/output.css

# generate _templ.go files from .templ files
FROM golang:alpine AS templbuilder
Expand Down Expand Up @@ -34,7 +34,8 @@ RUN chmod +x /app/unotone
# runner image
FROM scratch
WORKDIR /app
COPY --from=gobuilder /build/controllers/web/static /app/controllers/web/static
COPY --from=tailwindbuilder /build/controllers/web/static/output.css /app/controllers/web/static/output.css
ENV UNOTONE_STATIC_DIR /var/www/static
COPY --from=gobuilder /build/controllers/web/static ${UNOTONE_STATIC_DIR}
COPY --from=tailwindbuilder /build/static/output.css ${UNOTONE_STATIC_DIR}/output.css
COPY --from=gobuilder /app/unotone /app/unotone
CMD ["./unotone"]
1 change: 0 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ run-pod: podman-build
--name unotone-server \
--detach \
-e UNOTONE_ADDR=0.0.0.0:8080 \
-e UNOTONE_STATIC_DIR=./controllers/web/static \
-e UNOTONE_DEBUG={{ DEBUG }} \
unotone-server:latest

Expand Down

0 comments on commit 2fb964d

Please sign in to comment.