add Docker
This commit is contained in:
parent
d9664e4ea1
commit
9e87306fc9
4 changed files with 38 additions and 0 deletions
10
.dockerignore
Normal file
10
.dockerignore
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
*
|
||||||
|
|
||||||
|
!controllers
|
||||||
|
!go.mod
|
||||||
|
!go.sum
|
||||||
|
!main.go
|
||||||
|
!models
|
||||||
|
!routes
|
||||||
|
!services
|
||||||
|
!utils
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,3 +1,5 @@
|
||||||
|
.env
|
||||||
|
|
||||||
# Created by https://www.toptal.com/developers/gitignore/api/vim,go
|
# Created by https://www.toptal.com/developers/gitignore/api/vim,go
|
||||||
# Edit at https://www.toptal.com/developers/gitignore?templates=vim,go
|
# Edit at https://www.toptal.com/developers/gitignore?templates=vim,go
|
||||||
|
|
||||||
|
|
20
Dockerfile
Normal file
20
Dockerfile
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
FROM golang:1.22-alpine AS back
|
||||||
|
WORKDIR /usr/src/back/clandrier
|
||||||
|
|
||||||
|
#RUN go install github.com/swaggo/swag/cmd/swag@latest
|
||||||
|
|
||||||
|
COPY go.mod .
|
||||||
|
COPY go.sum .
|
||||||
|
RUN go mod download && go mod verify
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
#RUN swag init
|
||||||
|
RUN go build
|
||||||
|
|
||||||
|
FROM alpine AS app
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=back /usr/src/back/clandrier/calendrier .
|
||||||
|
|
||||||
|
CMD ["./calendrier"]
|
||||||
|
EXPOSE 8080
|
|
@ -20,6 +20,12 @@ services:
|
||||||
PGADMIN_DEFAULT_PASSWORD: test
|
PGADMIN_DEFAULT_PASSWORD: test
|
||||||
ports:
|
ports:
|
||||||
- 8081:80
|
- 8081:80
|
||||||
|
back:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- 8080:8080
|
||||||
|
env_file:
|
||||||
|
- .env
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
calendar_db: {}
|
calendar_db: {}
|
||||||
|
|
Loading…
Reference in a new issue