Skip to content

Commit

Permalink
Merge pull request #46 from FACorreiaa/feature/migrate-cdns-to-packag…
Browse files Browse the repository at this point in the history
…ejson

change package json file and add pines ui
  • Loading branch information
FACorreiaa authored Jun 15, 2024
2 parents d4e672b + bc05edb commit 47e366b
Show file tree
Hide file tree
Showing 18 changed files with 7,513 additions and 3,992 deletions.
59 changes: 27 additions & 32 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
# syntax=docker/dockerfile:1

# Build.
FROM golang:1.22 AS build-stage

LABEL Author="FC a11199"

FROM node:latest as assets
WORKDIR /app
COPY package.json ./
COPY package-lock.json ./
COPY postcss.config.cjs ./
COPY fonts.css ./
RUN mkdir -p app/static/css app/static/fonts
RUN npm install --ci
RUN npm run fonts
RUN npm run tailwind-build

# Define the "base" stage
FROM golang:latest as base
WORKDIR /app
COPY go.mod go.sum ./
COPY go.mod ./
COPY go.sum ./
RUN go mod download
COPY . /app
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -gcflags "all=-N -l" -o /entrypoint ./*.go

FROM build-stage AS app-dev
#we test
#RUN curl -sLO https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-arm64
#RUN chmod +x tailwindcss-linux-arm64
#RUN mv tailwindcss-linux-arm64 tailwindcss
COPY . .

# Define the "dev" stage
FROM base as app-dev
RUN curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
RUN GOOS=linux go install github.com/a-h/templ/cmd/templ@latest
WORKDIR /app
RUN go install github.com/a-h/templ/cmd/templ@latest
RUN templ generate
CMD ["air"]

FROM build-stage AS app-debug
RUN CGO_ENABLED=0 go install github.com/go-delve/delve/cmd/dlv@latest
WORKDIR /app

# Deploy.
FROM gcr.io/distroless/static-debian11 AS release-stage
WORKDIR /
COPY --from=build-stage /entrypoint /entrypoint
COPY --from=build-stage /app/app/static /app/static

COPY ./config /app/config
# COPY .env.compose .
EXPOSE 8080
USER nonroot:nonroot
ENTRYPOINT ["/entrypoint"]
# Define the final stage
FROM base as final
COPY --from=assets /app/controller/static/css/* ./controller/static/css/
COPY --from=assets /app/controller/static/fonts/* ./controller/static/fonts/
RUN CGO_ENABLED=0 go build -o /app/server
EXPOSE 6969
ENTRYPOINT ["/app/server"]
Loading

0 comments on commit 47e366b

Please sign in to comment.