add Docker

This commit is contained in:
rick 2024-02-24 16:26:57 +01:00
parent d9664e4ea1
commit 9e87306fc9
Signed by: Rick
GPG key ID: 5CBE8779CD27BCBA
4 changed files with 38 additions and 0 deletions

10
.dockerignore Normal file
View file

@ -0,0 +1,10 @@
*
!controllers
!go.mod
!go.sum
!main.go
!models
!routes
!services
!utils

2
.gitignore vendored
View file

@ -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
View 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

View file

@ -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: {}