support db migrations
This commit is contained in:
25
dockers/migrator/Dockerfile
Normal file
25
dockers/migrator/Dockerfile
Normal file
@ -0,0 +1,25 @@
|
||||
FROM golang:1.22-alpine as golang
|
||||
|
||||
ARG VERSION="unknown"
|
||||
ARG REVISION="unknown"
|
||||
ARG BUILDTIME=""
|
||||
|
||||
WORKDIR /go/src/git.loyso.art/frx/devsim
|
||||
COPY . .
|
||||
|
||||
RUN go mod download && \
|
||||
go mod verify && \
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build \
|
||||
-o /go/bin/migrator /go/src/git.loyso.art/frx/devsim/cmd/migrator/main.go
|
||||
|
||||
FROM gcr.io/distroless/static-debian12@sha256:ce46866b3a5170db3b49364900fb3168dc0833dfb46c26da5c77f22abb01d8c3
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=golang /go/bin/migrator /app/migrator
|
||||
COPY assets/db/migrations/ /app/db/migrations/
|
||||
|
||||
ENV DEVSIM_PG_MIGRATOR="/app/migrations"
|
||||
|
||||
ENTRYPOINT ["/app/migrator"]
|
||||
|
||||
|
||||
24
dockers/web/Dockerfile
Normal file
24
dockers/web/Dockerfile
Normal file
@ -0,0 +1,24 @@
|
||||
FROM golang:1.22-alpine as golang
|
||||
|
||||
ARG VERSION="unknown"
|
||||
ARG REVISION="unknown"
|
||||
ARG BUILDTIME=""
|
||||
|
||||
WORKDIR /go/src/git.loyso.art/frx/devsim
|
||||
COPY . .
|
||||
|
||||
RUN go mod download && \
|
||||
go mod verify && \
|
||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-w -s -X 'git.loyso.art/frx/devsim.Version=${VERSION}' -X 'git.loyso.art/frx/devsim.Revision=${REVISION}' -X 'git.loyso.art/frx/devsim.BuildTime=${BUILDTIME}'" \
|
||||
-o /go/bin/app /go/src/git.loyso.art/frx/devsim/cmd/web/main.go
|
||||
|
||||
FROM gcr.io/distroless/static-debian12@sha256:ce46866b3a5170db3b49364900fb3168dc0833dfb46c26da5c77f22abb01d8c3
|
||||
|
||||
WORKDIR /app
|
||||
COPY --from=golang /go/bin/app /app/web
|
||||
|
||||
ENV DEVSIM_HTTP_ADDR=":80"
|
||||
EXPOSE 80
|
||||
|
||||
ENTRYPOINT ["/app/web"]
|
||||
|
||||
Reference in New Issue
Block a user