This repository has been archived on 2024-12-07. You can view files and clone it, but cannot push or open issues or pull requests.
helseveileder/backend/Dockerfile

23 lines
500 B
Docker
Raw Normal View History

2024-01-12 20:33:20 +00:00
# syntax=docker/dockerfile:1
2024-01-12 21:01:59 +00:00
# Start from the latest golang base image
2024-01-12 20:52:46 +00:00
FROM golang:latest
2024-01-12 20:33:20 +00:00
2024-01-12 21:01:59 +00:00
# Set the Current Working Directory inside the container
2024-01-12 20:52:46 +00:00
WORKDIR /app
2024-01-12 20:33:20 +00:00
2024-01-12 21:01:59 +00:00
# Copy everything from the current directory to the PWD inside the container
COPY . .
2024-01-12 20:33:20 +00:00
2024-01-12 21:01:59 +00:00
# Download all the dependencies
RUN go mod download
2024-01-12 20:33:20 +00:00
2024-01-12 21:01:59 +00:00
# Build the Go app - change directory to 'cmd' where main.go resides
RUN go build -o main ./cmd
2024-01-12 20:33:20 +00:00
2024-01-12 21:01:59 +00:00
# Expose port 8080 to the outside world
2024-01-12 20:33:20 +00:00
EXPOSE 8080
2024-01-12 21:01:59 +00:00
# Command to run the executable
CMD ["./main"]