🐳 updated dockerfile
This commit is contained in:
parent
bf9334ed1f
commit
006fe93d08
2 changed files with 9 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
|
|
||||||
# Start from the latest golang base image
|
# Start from the latest golang base image
|
||||||
FROM golang:latest
|
FROM golang:latest AS build
|
||||||
|
|
||||||
# Set the Current Working Directory inside the container
|
# Set the Current Working Directory inside the container
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
@ -13,10 +13,13 @@ COPY . .
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
# Build the Go app - change directory to 'cmd' where main.go resides
|
# Build the Go app - change directory to 'cmd' where main.go resides
|
||||||
RUN go build -o main ./cmd
|
RUN go build -o /app/hello
|
||||||
|
|
||||||
# Expose port 8080 to the outside world
|
FROM alpine:latest
|
||||||
EXPOSE 8080
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY --from=build /app/hello .
|
||||||
|
|
||||||
# Command to run the executable
|
# Command to run the executable
|
||||||
CMD ["./cmd/main"]
|
CMD ["./hello"]
|
||||||
|
|
|
@ -16,7 +16,7 @@ services:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- 8000:8000
|
- 8080:8080
|
||||||
image: helseveileder
|
image: helseveileder
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
- postgres
|
||||||
|
|
Reference in a new issue