This paper develops a discrete-time risk model with general claim sizes in a Markovian environment where both claim occurrence probabilities and the claim size distributions are dependent on the regime of the environment. We assume that the environmental regime is governed by a Markov process with a finite state space. We utilize a G/M/1 type structure in the process of the surplus level and the regime. We also employ the matrix analytic method to analyze the sojourn time of the surplus process at each level until the ruin time. Under this framework we obtain several important quantities related to ruin. First, we derive the penalty function using the results on the surplus process until the ruin time. Second, we obtain the ruin probability, the ruin time distribution and the deficit distribution at ruin. Numerical examples implement the ruin quantities that we derive.