-
Notifications
You must be signed in to change notification settings - Fork 21
/
Dockerfile
34 lines (24 loc) · 853 Bytes
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
FROM nixpkgs/nix
WORKDIR /gotk4
# Prepare the Nix files.
COPY flake.nix flake.lock shell.nix ./
ENV NIX_PATH="nixpkgs=channel:nixos-unstable"
# Prepare docker-env.
RUN nix profile install --extra-experimental-features nix-command\ flakes '.#dockerEnv'
# Initialize shell environment variables.
RUN /root/.nix-profile/bin/docker-env init
# Execute everything with the shell environment variables.
SHELL ["/root/.nix-profile/bin/docker-env", "exec"]
ENTRYPOINT ["/root/.nix-profile/bin/docker-env", "exec"]
# Set the proper environment variables so -u works.
ENV HOME="/user/"
RUN mkdir -p /user && chmod -R 777 /user
# Populate Go things as a layer.
COPY go.mod go.sum ./
RUN go mod download
COPY pkg/go.mod pkg/go.sum ./pkg/
RUN cd pkg && go mod download
# Copy the rest of the source code.
COPY . .
# Drop into a shell by default.
CMD bash