add circleci

This commit is contained in:
Dawid Wysokiński 2021-04-16 06:38:48 +02:00
parent 48d55df7a9
commit a0f9646bcc
2 changed files with 29 additions and 3 deletions

26
.circleci/config.yml Normal file
View File

@ -0,0 +1,26 @@
version: 2
jobs:
build:
docker:
- image: circleci/golang:1.16
working_directory: ~/zdamegzzawodowybackend
steps:
- checkout
- setup_remote_docker
- run: |
docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
# build the application image
- run: docker build -t $DOCKER_LOGIN/zdam-egzamin-zawodowy-backend:latest .
# deploy the image
- run: docker push $DOCKER_LOGIN/zdam-egzamin-zawodowy-backend:latest
workflows:
version: 2
deploy_prod:
jobs:
- build:
context: Zdam-Egzamin-Zawodowy
filters:
branches:
only:
- master

View File

@ -11,7 +11,7 @@ RUN go mod download
# Copy the source from the current directory to the Working Directory inside the container
COPY . .
RUN go build -o main .
RUN go build -o zdamegzawodowy .
######## Start a new stage from scratch #######
FROM alpine:latest
@ -21,7 +21,7 @@ RUN apk --no-cache add ca-certificates
WORKDIR /root/
# Copy the Pre-built binary file from the previous stage
COPY --from=builder /app/main .
COPY --from=builder /app/zdamegzawodowy .
ENV MODE=production
ENV GIN_MODE=release
@ -30,4 +30,4 @@ EXPOSE 8080
ADD https://github.com/ufoscout/docker-compose-wait/releases/download/2.2.1/wait ./wait
RUN chmod +x ./wait
CMD ./wait && ./main
CMD ./wait && ./zdamegzawodowy